Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The Purpose of this question is to write a Prolog Program which describes a directed graph (G), with the following structure and allows us to
The Purpose of this question is to write a Prolog Program which describes a directed graph (G), with the following structure and allows us to ask some questions about this graph. From the graph described below create a prolog database with the below mentioned predicates. (a) flightPath/4 which stores originating Airport, destination Airport, flightTime and distance (Make use of flightconnections.com to find out the flight times (round it off to the closest integer e.g. 1h20 mins =1 and 1h35 = 2, etc.) (b) transferTime/2 which stores airport and time spent in immigration, baggage, etc. (You can choose a suitable rounded integer for time spent) NRT CDG LAX LJU JFK SIN FCO A. Write the below mentioned prolog rules and show some sample results by querying them. 1) connection(Start, Destination) to check whether destination can be reached from the starting airport or not. You should consider direct as well as indirect paths. 2) flightTime(Start, Destination, Time, Path) to compute the flight time for all possible paths. 3) pathLength(Path, Length) to compute the length of a given path (path will be a list). 4) shortestPath(Start, Destination) to print the shortest path between two airports. B. Create a knowledge base (KB) composed of all the facts and rules that you have written in parts (1), and (2), and save it in a prolog program file called flights.pl, and show a print of your program here. C. Run this Prolog program, and write 4 queries about each of those rules that you have created in part (A) in order to test those rules, and show your queries and their results, and test the correctness of your results. (Note: you should write and test two ground quires (one with positive and one with negative answer) and two non-ground quires for each of the rules that you have created.) The Purpose of this question is to write a Prolog Program which describes a directed graph (G), with the following structure and allows us to ask some questions about this graph. From the graph described below create a prolog database with the below mentioned predicates. (a) flightPath/4 which stores originating Airport, destination Airport, flightTime and distance (Make use of flightconnections.com to find out the flight times (round it off to the closest integer e.g. 1h20 mins =1 and 1h35 = 2, etc.) (b) transferTime/2 which stores airport and time spent in immigration, baggage, etc. (You can choose a suitable rounded integer for time spent) NRT CDG LAX LJU JFK SIN FCO A. Write the below mentioned prolog rules and show some sample results by querying them. 1) connection(Start, Destination) to check whether destination can be reached from the starting airport or not. You should consider direct as well as indirect paths. 2) flightTime(Start, Destination, Time, Path) to compute the flight time for all possible paths. 3) pathLength(Path, Length) to compute the length of a given path (path will be a list). 4) shortestPath(Start, Destination) to print the shortest path between two airports. B. Create a knowledge base (KB) composed of all the facts and rules that you have written in parts (1), and (2), and save it in a prolog program file called flights.pl, and show a print of your program here. C. Run this Prolog program, and write 4 queries about each of those rules that you have created in part (A) in order to test those rules, and show your queries and their results, and test the correctness of your results. (Note: you should write and test two ground quires (one with positive and one with negative answer) and two non-ground quires for each of the rules that you have created.)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started