Get Instant Help From 5000+ Experts For

Writing: Get your essay and assignment written from scratch by PhD expert

Rewriting: Paraphrase or rewrite your friend's essay with similar meaning at reduced cost

Problem Description

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.

Question 2. Functional solution (Scheme) [3 marks]

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!