Question: This part contributes to module outcomes 1 and 2 . The TSP will be implemented as follows: suppose there are n cities. You will create
This part contributes to module outcomes and
The TSP will be implemented as follows: suppose there are n cities. You will create an nbyn matrix M with one row and one column per city. Mij gives the cost of going from city i to city j If there is a road from i to j then Mij is a positive integer, otherwise it is by convention. We assume all roads are bidirectional so M is symmetric. A tour is a path that starts at city visits every other city once, and ends back at city A minimal tour is one with minimum cost where the cost of a tour is the sum of the costs of the roads that constitute it Note there may be more than one minimal tour.
The TSP asks that we find a minimal tour.
d Given a tour generated from matrix M how do you compute its cost? If this question feels easy, it is
e Just in case your algorithm gets a matrix M that does not contain any tours eg it is not possible to come back to the starting city it's a good idea to be able to detect that and output some message like "This matrix does not contain any tours" before you attempt to find nonexistent tours. How do you detect that?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
