Problem description: A travelling salesman wants to make a tour of the cities and returns back to the starting point. What is the minimum length tour?
o Input: A set S = {P_{1}, P_{2, }..., P_{n}} of n points representing the locations of n cities. The coordinates of P_{i} is (x_{i}, y_{i}). For simplicity, the coordinates x_{i }and y_{i} are integers in [0..1000), i.e., 0 ≤ x_{i}, y_{i} ≤ 999, i= 1,2,..,n. The distance between P_{i }and Pj_{ }is defined as |x_{i}- x_{j}|+|y_{i}- y_{j}|.
o Output: A TSP tour that starts from P_{1}, visit all the cities (P_{i}, i=2,3..,n) and return back to starting point P_{1}
o Objective: Minimize the total length of the TSP tour.
HEURISTICS
- Minimum Spanning Tree (MST) Based Heuristic
- Construct a MST, T, for the points in S from starting point P_{1};
- Traverse around T to get the initial TSP tour for S;
- Exploit the triangular inequality and remove unnecessary visits in the TSP tour.
- Compute the length of the tour.
- Nearest Neighbour Heuristic
- current position ← P_{1};
- Loop for n-1 steps
- At each step, choose to visit next the city that is closest to the current position;
- Update the current position;
o Including the closing edge (back to P_{1}) in the tour;
o Compute the length of the tour.
TASKS
1. Implement the MST Based Heuristic;
2. Implement the Nearest Neighbour Heuristic;
3. Implement a function, randomSetGenerator that will generate a set of random points on the L1-metric Plane.
4. Conduct the following experiment for n=100
o Repeat the following for 10 times
§ Call randomSetGenerator to generate a set S of n random points.
- Feed S to the MST Based Heuristic. Record the length of the tour and the execution time.
- Feed S to the Nearest Neighbour Heuristic. Record the length of the tour and the execution time.
o Compute the average length of the tour and the average execution time for the MST Based Heuristic.
o Compute the average length of the tour and the average execution time for the Nearest Neighbour Heuristic.
5. Repeat the above experiments for n = 200, 300, 400, 500, 600, 700, 800, 900 and 1000. Collect the statistics (average length of the tour and average execution time) from the experiments. Compare the two heuristics in term of the average length of the tour and average execution time.