[Solved] CMPE260 Project 1

30 $

SKU: [Solved] CMPE260 Project 1 Category: Tag:


  • Use SWI Prolog (available on swi-prolog.org/Download.html)
  • Comment all your code very well. For the facts you manually encode, tell which clue is related to the fact. for each predicate describe how your code works. You should follow the programming guidelines (e.g. + for input, – for output)
  • Submit two files. The first file should be named namesurname manualfacts.pl, the second file is named namesurname solution.pl
  • We will test your program with our own database.1
  • This is an individual project. Do not discuss your solution with others.
  • ou will submit all your documents zipped into a single file named as ”nameszip”(alllowercase)tothecmpe260pagein

2 The goal of the project

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]).


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.
  7. The shipment going to uskudar is fatma’s.
  8. The shipment that cost 8 is either feride’s shipment or nazan’s package.
  9. Of the package that cost 9 and ayse’s package, one contains the fruit basket and the other is going to beyoglu.
  10. 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. All auxilary predicates and shipmentInfo/1 should be in namesurname solution.pl.


There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CMPE260 Project 1
30 $