The City of Ottawa owns and maintains many wading pools which need to be regularly maintained. The repair crew needs to find a route to visit the pools. You will have to help the crew to find a reasonable route to visit all pools. A route is reasonable if all pools are visited and the route is not too long. An optimal route is not required.
This is a problem where the nodes are the pools and the edges have weights corresponding to the distance between pools (We will just use the Euclidean distance and do not consider the road network).
Question 1. Logic solution (Prolog) [3 marks]
Write a Prolog predicate find Route/1 with the solution returned in the argument in the form of a list. You must also provide the predicate saveRoute/2 that takes as first argument the above solution and as a second argument a file name in which the solution will be stored.
In addition, you must provide the list of the defined predicates with a short definition for each of them.
Write a Scheme function findRoute with the file name of your intermediate file format as argument. You must also provide the function saveRoute that takes as first argument the above solution and as a second argument a file name in which the solution is stored and will evaluate to true on success. Note that to build your solution, you are not allow to use any of the standard functions that end with a!
CSI2120 Programming Paradigms
Answer in Detail
Solved by qualified expert
Page 1 of 7
6 More Pages to Come in This Document. Get access to the complete answer.