Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 3: Travelling Salesman Problem [40] Write code in a language of your choice to solve this problem. Hand in the source code with your
Question 3: Travelling Salesman Problem [40] Write code in a language of your choice to solve this problem. Hand in the source code with your submission, making clear that the file is/are for Question 3. If you think it will be easier, you are welcome to use external code and libraries with citation, as long as they do not come from current or past students in COMP 424, but please implement your own greedy local search method. Consider the travelling salesman problem, as described in class. For parts a) - c), write code to generate 100 random TSP instances involving 7 cities, where cities lie at points in the 2D plane ((0.0,1.0],[0.0,1.0]), sampled uniformly at random. Your code should be correct but will not be marked for style. Use Euclidean distance as your distance measure between cities. a) Solve each TSP exactly by brute-force search over all possible tours. Record and save these costs. In your report, simply state where in your code this is implemented, and state the mean, min, max, and standard deviation of the optimal tour lengths across the 100 instances. b) As a baseline, generate a random tour for each of the 100 instances. What is the mean, min, max, and standard deviation of the tour lengths found? Report the number of instances for which the random tour happens to be the optimal solution (may be zero). c) Implement and apply hill climbing/greedy local search using the 2-change neighbourhood function described in class on the 100 instances, using the randomly sampled start state from part b). What is the mean, min, max, and standard deviation of the tour lengths found? Also report the number of instances for which the algorithm found the optimal solution. d) Scale up your experiments! Repeat parts b) and c) using 100 random TSP instances involving 100 cities. Since the number of possible tours is factorial with respect to the number of cities, it may no longer be feasible to compute the costs of the optimal solutions in a reasonable amount of time, so simply omit that part of the table. (If you have extra time, you can find libraries to help you plot and visualize the solutions found by your algorithms, but this is not necessary for the submission.)
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