Starting from:

$25

CMPE260-Project 1 Prolog Programming Project Solved

In this project our goal is to use logic programming to determine the shipping costs for each customer, and determine what’s in each package and where it is being shipped to.

3         Tasks
The first task is to copy the basicfacts.pl posted on Moodle into your working directory. The file contains facts about shipments.

item ([ basketball , computer , fruit  basket , rare  book , tea  set , tv ] ) . customer ([ ayse , fatma , hayriye , feride , nazan , naciye ] ) . town ([ sariyer , besiktas , uskudar , beykoz , beyoglu , kadikoy ] ) . price ([4 ,5 ,6 ,7 ,8 ,9]).

1

The second task is to manually encode the clues given below in Prolog. You may only use the given information directly. You cannot add your own deductions as rules. Using these clues, create at least one fact for each clue. The manually encoded facts should be put in namesurname manualfacts.pl.

1.   Neither the package with the television in it nor hayriye’s package is the shipment going to beykoz.

2.   The shipment with the television in it cost 1 lira more than the package going to uskudar.

3.   The shipment with the basketball in it didn’t cost 9 .

4.   The package with the computer in it is either the shipment that cost 6  or hayriye’s package.

5.   hayriye’s package cost 1 lira less than the shipment going to kadikoy.

6.   The shipment with the basketball in it is either naciye’s shipment or the package that cost 4 . 7. Neither the shipment with the rare book in it nor the package that cost 9   is feride’s shipment.

8.      The shipment going to uskudar is fatma’s.

9.      The shipment that cost 8  is either feride’s shipment or nazan’s package.

10.   Of the package that cost 9  and ayse’s package, one contains the fruit basket and the other is going to beyoglu.

11.   Of fatma’s package and the package going to besiktas, one cost 6  and the other contains the television.

The third task is to write a Prolog predicate shipmentInfo(+Name) which matches the information given from the clues. Once called, the predicate should print out(using the write function) the customer name, item, town and price in the following format:

?− shipmentInfo (name1 ).

        Shipment :      customer1 ,        item3 , town2 ,        price4 .

You may need additional deductions to find the solution for each shipment. Put all your auxilary predicates in this file. Do not your own deductions that you find manually, provide the program to find the solution

More products