CPS 721 Quiz 5
2021 Practice Version
(not shared) Switch account
Prolog Murder Mystery
Copyright By PowCoder代写 加微信 powcoder
The first two questions will use the murder mystery problem from the lab, listed again for reference below:
To discover who killed Mr. Boddy, you need to learn where each person was, and what weapon was in the room.
To begin, you need to know the suspects. There are three men (Ben, Dave, Frank) and three women (Angela, Christine, Eleanor). Each person was in a different room (Bathroom, Dining Room, Kitchen, Living Room, Pantry, Study). A suspected weapon was found in each room (Bag, Firearm, Gas, Knife, Poison, Rope).
Clue 1: Angela was either in the study or the bathroom; Eleanor was in the other.
Clue 2: The person with the bag, who was not Angela nor Ben, was not in the bathroom nor the dining room.
Clue 3: The woman with the rope was found in the study.
Clue 4: The man in the kitchen was not found with the rope, knife, bag, or firearm. Clue 5: The weapon in the living room was found with either Dave or Ben.
Clue 6: The knife was not in the dining room.
Clue 7: Eleanor was not with the weapon found in the study nor the pantry.
Clue 8: The firearm was in the room with Ben.
It was discovered that Mr. Boddy was gassed in the pantry. The suspect found in that room was the murderer. Who, then, do you point the finger towards?
Clue 6 states ‘The knife was not in the dining room.’ Assuming no variables have yet been instantiated, how would this clue be implemented in the ‘solve’ predicate?
person(X), not (X = knife, X = dining_room)
room(Knife), not Knife = dining_room, weapon(DR), not DR = knife not weapon(knife) = room(dining_room)
person(Knife), person(DR), not Knife = DR
Clue 8 states ‘The firearm was in the room with Ben.’ Assuming no variables have yet been instantiated, how would this clue be implemented in the ‘solve’ predicate?
person(FA), FA = firearm, person(Ben), Ben = ben, FA = Ben person(FA), FA = ben
weapon(firearm) = person(ben)
person(Ben), Ben = firearm
person(Ben), weapon(FA), FA = is the ‘smart interleaving’ paradigm for solving CSPs more efficient than the ‘generate and test’ paradigm?
Fewer backtracking steps are required to fix an incorrect variable assignment The ‘all_diff’ predicate checking uniqueness isn’t necessary
Fewer constraints are enforced
The problem domain contains fewer values
You are given a CSP where four houses sit on different corners of a crossroads. The owner of each house has a different name, owns a different type of pet, and has painted their house a different colour. Clues such as ‘Carol lives in the house on the north corner’ and ‘The person who owns a parrot lives across from the blue house’ are given. What is the most suitable domain for this problem?
Clear form
The names of the people, e.g. person(carol).
The corner each house is on, e.g. corner(north). The types of pet in each house, e.g. pet(parrot). The colour each house is painted, e.g. colour(blue). Any of the above.
This form was created inside of . Report Abuse Forms
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com