TSP – Upper Bounds and Lower Bounds Initial problem : Upper Bound A salesman based in Stockton needs to visit shops based in Darlington, Billingham, Middlesbrough, Hartlepool and Yarm and return to Stockton. What is the minimum distance he needs to travel?
TSP – Upper Bounds and Lower Bounds The model The distances between the towns is given below: SMDHYB S M D H Y B D M S B Y H
TSP – Upper Bounds and Lower Bounds Nearest neighbour algorithm 1. Choose any vertex as the starting point. 2. From the vertices not already selected find the nearest vertex to the last one. 3. Repeat step 2 until all vertices have been selected. 4. Join the last vertex to the first vertex. 5. Repeat for different starting vertices. 6. Choose the smallest upper bound.
TSP – Upper Bounds and Lower Bounds 1. Choose a starting vertex D M S B Y H S is chosen as a starting vertex. S
TSP – Upper Bounds and Lower Bounds 2. Find the nearest vertex D M S B Y H B is the nearest vertex to S (the last one). S B 4
TSP – Upper Bounds and Lower Bounds 3. Repeat 2 ‘til all vertices selected D M S B Y H M is the nearest vertex to B. S B 4 M 6 Y is the nearest vertex to M (not already selected). Y 9 D is the nearest vertex to Y (not already selected). D 13 H is the nearest vertex to D (not already selected). H 25
TSP – Upper Bounds and Lower Bounds 4. Join the last vertex to the first D M S B Y H H is joined to S. S B 4 M 6 Y 9 D 13 H The resulting tour has length: = 69
TSP – Upper Bounds and Lower Bounds 5. Repeat for a different start vertex Upper bound found starting at S: Upper bound found starting at D: Upper bound found starting at B: Upper bound found starting at H: Upper bound found starting at M: Upper bound found starting at Y: 69 64* 64 *Choosing DY as first edge
TSP – Upper Bounds and Lower Bounds 6. Choose the least upper bound The shortest tour (least upper bound) has length 64. D M S B Y H S B 4 M 6 Y 6 D 13 H D-Y-S-B-M-H-D has been chosen, but we could have had B-S-M-Y-D-H-B
TSP – Upper Bounds and Lower Bounds Initial problem: Lower Bound A salesman based in Stockton needs to visit shops based in Darlington, Billingham, Middlesbrough, Hartlepool and Yarm and return to Stockton. What is the minimum distance he needs to travel?
TSP – Upper Bounds and Lower Bounds The model The distances between the towns is given below: SMDHYB S M D H Y B D M S B Y H
TSP – Upper Bounds and Lower Bounds An algorithm – Nearest Neighbour 1. Choose a vertex and delete it and all its edges from the network. 2. Find a minimum connector for the remaining network using Kruskal’s or Prim’s. 3. Add in the weights of the two least weight deleted edges. 4. Repeat deleting a different vertex. 5. Choose the greatest lower bound.
TSP – Upper Bounds and Lower Bounds 1. Choose a vertex and delete it S B Y H D M D is chosen (arbitrarily) and deleted along with all of the edges from D.
TSP – Upper Bounds and Lower Bounds 2. Find a minimum connector S B Y H D M A minimum connector is found (in this case using Kruskal’s algorithm)
TSP – Upper Bounds and Lower Bounds 3. Add in 2 least deleted edges S B Y H D M The two deleted edges of least weight are added back in The Lower Bound found by deleting D has weight : = 49
TSP – Upper Bounds and Lower Bounds 4. Repeat using a different vertex Lower bound found by removing D: Lower bound found by removing S: Lower bound found by removing B: Lower bound found by removing H: Lower bound found by removing M: Lower bound found by removing Y:
TSP – Upper Bounds and Lower Bounds 5. Choose greatest lower bound The greatest lower bound found is 49 S B Y H D M
TSP – Upper Bounds and Lower Bounds Interpreting the Upper and Lower Bound Values The greatest lower bound found is 49 The shortest tour (least upper bound) has length 64. So the actual route lies between 49 and 64. It is definitely possible to do it in 64 but a shorter route may be possible. This can only be found by trial and error If the UB and the LB are the same then that is the answer The smaller the gap the better