Question: Please use c++ to do the following code The objective of this project is to (1) correctly implement the exhaustive approaches to solving TSP (2)

Please use c++ to do the following code

The objective of this project is to (1) correctly implement the exhaustive approaches to solving TSP (2) compare these with their asymptotic complexities. Your program should assume the input file is formatted as follows: 4 0 0 10 0 0 5 10 5 The first line contains n, the number of points. Each of the next n lines contains the (x, y) coordinates of the n points. Assume all coordinates are integers. Your output should report the length of the TSP tour to three places of decimal. For consistency with our solutions, your tour should start at the first point listed in the input. [In the example this would be (0, 0).] The output would be: 30.000 This would correspond to the following NN TSP tour (0,0) (0,5) (10,5) (10,0) (0,0). The second approach is the exhaustive algorithm that we discussed in class that tries all permutations. Pseudocode may be found on Page 8 of the text. This approach is guaranteed to find an optimal solution, but is very slow. You may use a library, consult the internet or any other reliable source to find code or an algorithm to generate all permutations.

Pseudocode:

OptimalTSP(P)

d =

For each of the n! permutations Pi of point set P

If (cost(Pi) d) then d = cost(Pi) and

Pmin = Pi

Return Pmin

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!