Answered step by step
Verified Expert Solution
Question
1 Approved Answer
*Need to be coded in ASP using Running clingo (potassco.org) *Configuration: reasoning mode = enumerate all * need last three TODO (pictures below % TODO
*Need to be coded in ASP using Running clingo (potassco.org)
*Configuration: reasoning mode = enumerate all
* need last three TODO (pictures below
% TODO by you: Say that no other spots are adjacent.
-adjacent(S,X) :-
%%% GENERATE candidate solutions % TODO by you
%%% TEST whether a candidate solution is a real solution or not % TODO by you
EXPECTED OUTPUT :
(2). (50 points) Complete the code in ex2.txt to solve the following problem using the generate-and-test methodology: A group of 6 people (labeled from 1 to 6) go to a retreat where they do an exercise in which they are all supposed to sit in a circle. There are 6 spots (also labeled from 1 to 6) marked on the floor indicating where they could each sit. We know that some people like other people in the group, which is represented by the relation likes(X,Y) person X likes person Y. We also know that there are people in the group who dislike each other, which is represented by the relation dislikes (X,Y) - person X dislikes person Y. Assume that likes and dislikes are symmetric relations. Your job is to find an assignment of people to spots on the floor such that: - people who like each other sit next to each other and 1 - people sitting next to each other do not dislike each other. Of course, each person should be assigned to exactly one spot and each spot should have exactly one person assigned. Note that, in some scenarios (e.g., if everybody dislikes everybody), this problem may not have a solution. Use and extend the starter code provided in the file ex2.txt. Make sure to define the following relation (i.e., write a rule or rules about it): assigned (P,S) - person P is assigned spot S If you do not modify the likes and dislikes facts I provided, you should get 12 answer sets. Make sure to use the command clingo ex2.txt 0 when running your file using the command 7ine, or select "Enumerate A 1 "" as the "reasoning mode" when using clingo online. The order in which you see these answer sets does not matter. Answer: 1 arrangement (6,1,2,3,4,5) Answer: 2 arrangement (4,3,2,1,6,5) Answer: 3 arrangement (1,2,3,4,5,6) Answer: 4 arrangement (2,1,6,5,4,3) Answer: 5 arrangement (4,5,6,1,2,3) Answer: 6 arrangement (1,6,5,4,3,2) Answer: 7 arrangement (3,2,1,6,5,4) Answer: 8 arrangement (5,6,1,2,3,4) Answer: 9 arrangement (3,4,5,6,1,2) Answer: 10 arrangement (5,4,3,2,1,6) Answer: 11 arrangement (6,5,4,3,2,1) Answer: 12 arrangement (2,3,4,5,6,1)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started