The Travelling Salesman problemEdexcel A-Level Further Maths: Revision notes
Section 1
Practical and classical problems
The Travelling Salesman problem asks for the shortest closed route that visits every vertex of a network. The classical problem asks for a Hamiltonian cycle: each vertex is visited exactly once and you return to the start. It is set on a complete graph, where every pair of vertices is joined by an arc, and the arc weights satisfy the triangle inequality: for any three vertices, the direct distance is no more than the distance by way of the third vertex. The practical problem asks for the shortest route that visits every vertex at least once, returning to the start. The network need not be complete, so vertices and arcs may be repeated. There is no efficient algorithm that is certain to find the shortest tour. Instead we find an upper bound and a lower bound between which the answer must lie.
Mixing up the two problems. Exactly once is the classical problem; at least once is the practical problem.
Section 2
Turning a network into a complete network of least distances
If the network is not complete, build a complete network in which the weight of each arc is the least distance between its two vertices in the original network. Use inspection or a shortest path algorithm, and write the answers in a table. Example: roads BD = 11, BC = 4 and CD = 5. The least distance from B to D is B–C–D = 9, not 11. The least distances automatically satisfy the triangle inequality, so the classical problem can now be solved on the new network. To give a route in the original network, replace each arc by the roads it represents.
Check every indirect route, because a direct road is sometimes longer than a route through other vertices.
Section 3
Upper bounds: nearest neighbour and the minimum spanning tree
Any tour is an upper bound, because the shortest tour cannot be longer than any tour you can find. Nearest neighbour algorithm: from the start vertex, travel to the nearest unvisited vertex, repeating until all are visited, then return to the start. The length is an upper bound. Start from different vertices to look for a smaller one. Minimum spanning tree method: find a minimum spanning tree with Kruskal's or Prim's algorithm. Walking round the tree twice visits every vertex and has length 2 × (weight of tree), which is an upper bound. Shortcuts: a walk that revisits a vertex can skip it by going directly to the next unvisited vertex. By the triangle inequality the direct arc is no longer than the route it replaces, so the new tour gives an improved upper bound.
Forgetting the final arc back to the start vertex when using nearest neighbour.
Section 4
The lower bound
To find a lower bound using a minimum spanning tree:
- Delete one vertex and all the arcs joined to it.
- Find the weight of the minimum spanning tree of the remaining vertices.
- Add the weights of the two shortest arcs joined to the deleted vertex. Any tour contains a path through the remaining vertices (which is a spanning tree, so it weighs at least the minimum) plus two arcs at the deleted vertex, so the shortest tour cannot be less than this total. You can delete any vertex. The best lower bound is the largest value found, so deleting different vertices may give a higher bound.
The two arcs added at the deleted vertex are the two shortest arcs that join to it, not the two joined to the tree.
Section 5
Using the bounds
Let the shortest tour have length L. If the lower bound is 64 and the best upper bound is 66, then 64 ≤ L ≤ 66. When you find a better upper bound, use it. When the lower bound equals the upper bound, you have found the optimal tour. Worked example: the nearest neighbour tour from A is 66. Deleting A gives MST 31 and arcs 15 and 18, so the lower bound is 64. Therefore the shortest route is between 64 and 66 km. In the exam, state the tour, the method and the interval, and write bounds with the correct units.
Using a lower bound with the wrong two arcs, or stating that the lower bound is the answer.
That's the notes covered.
Carry on to the next subtopic.
Exam questions on The Travelling Salesman problem
- A salesman must visit each of towns A, B, C, D and E once, starting and finishing at A. The distances in km between the towns are: AB 12, AC 10, AD 14, AE 8, BC 3, BD 7, BE 9, CD 6, CE 11 and DE 12.Use the nearest neighbour algorithm, starting at A, to find an upper bound for the length of the shortest route.2 marks
- A courier must visit depots A, B, C, D and E and return to the start. The only direct roads and their lengths in km are: AB 6, BC 4, CD 5, DE 3, AE 12, BD 11 and CE 10.Find the least distance between B and D, and the least distance between C and E.2 marks
- A delivery driver must visit five shops A, B, C, D and E, starting and finishing at A, and visiting each shop exactly once. The distances in km between the shops are: AB 15, AC 22, AD 25, AE 18, BC 10, BD 20, BE 12, CD 14, CE 16 and DE 9. These distances satisfy the triangle inequality.Find a lower bound for the length of the shortest route by deleting shop A.3 marks
Written by the Exaim team, led by Shaun Daswani (Head of Upper Secondary, Improve ME Institute; MSc Financial Mathematics, Imperial College London; BSc, UCL) and Jason Daswani (operational lead, Improve ME Institute; LSE).