Write a prolog program using swi proglog

Assignment Help Programming Languages
Reference no: EM13505

Question 1

We are given the following knowledge base of travel information:

 byCar(auckland,hamilton).  
 byCar(hamilton,raglan).  
 byCar(valmont,saarbruecken).  
 byCar(valmont,metz).  
 byTrain(metz,frankfurt).  
 byTrain(saarbruecken,frankfurt).  
 byTrain(metz,paris).  
 byTrain(saarbruecken,paris).  
 byPlane(frankfurt,bangkok).  
 byPlane(frankfurt,singapore).  
 byPlane(paris,losAngeles).  
 byPlane(bangkok,auckland).  
 byPlane(singapore,auckland).  
 byPlane(losAngeles,auckland).
 
a) Write a predicate travel/2 which calculates whether it is possible to  travel from one place to another by chaining together car, train, and  plane journeys. For example, your program should answer yes to the  query travel(valmont,raglan).

So, by using travel/2 to query the above database, you can ?nd out that  it is possible to go from Valmont to Raglan. If you are planning such a  voyage, that's already something useful to know, but you would probably prefer to have the precise route from Valmont to Raglan.

b) Write a predicate travel/3 which tells you which route to take when travelling from one place to another. For example, the program should respond 

X = go(valmont,metz,

 go(metz,paris,

 go(paris,losAngeles)))

to the query travel(valmont,losAngeles,X).

c) Extend the predicate travel/3 so that it not only tells you the route to take to get from one place to another, but also how you have to travel.

Reference no: EM13505

Questions Cloud

Case study on patient in the haematology laboratory : Write a case study which detailing a scenario of a patient being investigated in the Haematology laboratory.
Prepare a marketing plan : The aim of this assignment is to Prepare a Marketing Plan.
Implement a database of courses and students for a school : Implement a database of courses and students for a school.
Use a search tree to find the solution : Explain how will use a search tree to find the solution.
Write a prolog program using swi proglog : Write a Prolog program using swi proglog
Compute the speed of single-stage planetary gear train : Write a MATLAB function [speed] = planetary (N, emesh, first, last, arm) that computes the speed of a given link in a single-stage planetary gear train.
Product analysis : This question begins a process of finding out about why people like some of the products they own or use. Find one willing participant to help. It could be a family member, a friend, a work colleague or someone else you know.
Random integral numbers based on normal distribution : Prepare a system to generate random integral numbers based on normal distribution. Study Data Generator's structure and extend number generation type to activate normal distribution.
Calculate the value of the merged company : Calculate the value of the merged company, the gains (losses) to each group of shareholders, NPV of the deal under different payment methods. Synergy remains the same regardless of payment method.

Reviews

Write a Review

Programming Languages Questions & Answers

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd