Question
Can someone help me with this ASP program? I totally have no idea how to start it.i'm so confused about it. Write an ASP program
Can someone help me with this ASP program? I totally have no idea how to start it.i'm so confused about it.
Write an ASP program to be run with the DLV solver that solves the following problems using the generate-and-test methodology:
Given a round table with six chairs and a group of six people, some of whom are married and some of whom do not like each other, find a seating assignment for members of this group such that husbands and wives are seated next to each other and no neighbors dislike each other. Marriage is a symmetric relationship, but disliking is not necessarily symmetric(e.g., person A dislikes B, but B may like A).
Make sure to define the relation:seated(P, C)person Pis sitting on chair number C
Use and extend the starter code provided in the file problem3.txt.
the txt file:
% Run using the command%
dlv problem3.txt -filter=seating#const
n=6.person(1..n).chair(1..n).
% -----------------------------------------------------%
Test problemmarried(1, 2).married(3, 4).dislikes(1, 3).dislikes(1, 4).dislikes(1, 5).dislikes(2, 4).dislikes(2, 5).dislikes(2, 6).dislikes(3, 5).dislikes(3, 6).
% End of test problem% -----------------------------------------------------%
Instruction:%
Use the predicate seated(P, C) to say that person P is seating on chair number C
%%% GENERATE candidate solutions%
TODO by you%%%
TEST whether a candidate solution is a real solution or not
% TODO by you% -----------------------------------------------------%
For easy display%
seating(P1, P2, P3, P4, P5, P6) says that person P1 sits on chair 1, P2 on chair 2, etc.seating(P1, P2, P3, P4, P5, P6) :- seated(P1, 1), seated(P2, 2), seated(P3, 3), seated(P4, 4), seated(P5, 5), seated(P6, 6).
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