Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

% Run using the command: % clingo ex1.txt contestant(isaac). contestant(marco). contestant(sergio). contestant(tommy). sport(basketball). sport(football). sport(golf). sport(hockey). vote(4). vote(11). vote(18). vote(25). % We will be using

% Run using the command: % clingo ex1.txt contestant(isaac). contestant(marco). contestant(sergio). contestant(tommy). sport(basketball). sport(football). sport(golf). sport(hockey). vote(4). vote(11). vote(18). vote(25). % We will be using the following predicates to construct the solution % played(C, S) - contestant C played sport S % received(C, N) - contestant C received N votes % ------------------ % GENERATE CANDIDATE SOLUTIONS % TODO: write rules to say that: % - there is a one-to-one correspondence between contestants and sports % (use predicated played) % (i.e., each contestant played exactly one sport and % each sport was played by exactly one contestant) % % - there is a one-to-one correspondence between contestants and votes % (use predicated received) % ------------------ % TEST % Use the relations played/2 and received/2 from the comments above % 1. Tommy played hockey. % TODO - encode this hint % 2. The hockey player received 14 votes more votes than Sergio. % TODO - encode this hint % Rephrase it as "It is impossible for the hockey player not to % have received 14 votes more votes than Sergio." % Encode it as a constraint. % 3. Isaac is either the golf player or the hockey player. % TODO - encode this hint

% 4. Marco is either the contestant who got 25 votes or the golf player. % TODO - encode this hint % 5. Marco played football. % TODO - encode this hint % ------------------ % DISPLAY person(C, S, N) :- played(C, S), received(C, N). #show person/3. #show played/2. #show received/2.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

6th Edition

1943153035, 978-1943153039

More Books

Students also viewed these Databases questions

Question

Appreciate the advantages of arbitration

Answered: 1 week ago

Question

Are robots going to displace all workers? Explain your answer.

Answered: 1 week ago