Using predicate travel to query the database


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 predicate travel/2 that determines whether it is possible to travel from one place to another by chaining together car, train, and plane journeys. For example, your program must answer yes to the query travel(valmont,raglan). So, by using travel/2 to query the above database, you could find 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 maybe prefer to have precise route from Valmont to Raglan.

b) Write the  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 a query travel(valmont,losAngeles,X).

c) Extend 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. i.e., new program must let you know, for each stage of the voyage, whether we require to travel by car, train, or plane. Test your predicates thoroughly.

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Using predicate travel to query the database
Reference No:- TGS0462

Expected delivery within 24 Hours