A Level Further Mathematics · Chapter 67 · Decision Mathematics · Decision 1
Finding the shortest tour through every city is famously hard, so instead we trap the answer between an upper bound and a lower bound.
A delivery driver must visit every shop once and return to the depot, travelling as little as possible. No quick algorithm is known for finding the best tour, so this chapter teaches methods that find good tours and prove how close they are to the best.
In this chapter · jump to a section
Start here
Your route through this chapter
By the end of this chapter you will be able to:
- distinguish the classical and practical travelling salesman problems
- build a table of least distances and count the possible tours
- use the nearest neighbour algorithm to find an upper bound
- use the deleted-vertex method to find a lower bound
- find upper bounds from a minimum spanning tree with shortcuts
- combine bounds to judge how good a tour is, and recognise an optimal tour
Time: two sessions, about 3 hours, plus the practice ladder and the exam workshop.
You need first: minimum spanning trees and shortest paths, especially Prim's algorithm on a matrix and shortest distances.
The big idea
The big idea
A tour visits every vertex and returns to the start. The travelling salesman problem asks for the shortest tour. Checking every tour is hopeless for large networks. Instead we find an upper bound from a good tour and a lower bound from a clever argument, and the best tour lies between them.
This chapter uses five towns A, B, C, D and E, with this table of least distances in kilometres.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| A | – | 12 | 4 | 5 | 6 |
| B | 12 | – | 10 | 11 | 9 |
| C | 4 | 10 | – | 7 | 8 |
| D | 5 | 11 | 7 | – | 10 |
| E | 6 | 9 | 8 | 10 | – |
The highlighted tour has length 37. The methods in this chapter show that no tour can be shorter than 34. So whatever the best tour is, its length lies between 34 and 37.
Tours and Hamiltonian cycles
A tour is a Hamiltonian cycle: it visits every vertex exactly once and returns to the start. In a complete network, every ordering of the vertices gives a tour. The travelling salesman problem asks which of these is shortest.
Why the problem is hard
The number of tours grows like a factorial. Five towns give only 12 tours, but twenty towns give more than . No algorithm is known that finds the best tour efficiently for every network, so bounds are the practical approach.
Upper bounds
Any actual tour gives an upper bound: the best tour is at most that long. A good heuristic, such as the nearest neighbour algorithm, finds a fairly short tour quickly. The lower the upper bound, the more useful it is.
Lower bounds
A lower bound is a length that no tour can beat. It comes from an argument about the structure of every tour, not from a particular tour. The higher the lower bound, the more useful it is.
Trapping the answer
Together, the bounds give an interval containing the optimal length. If the interval is narrow, a tour at its top is nearly optimal. If the bounds meet, the tour is proved optimal.
Reading a distance table
Each entry gives the least distance between two towns. The table is symmetric, so only the entries above the diagonal are needed. Dashes on the diagonal show that a town is not joined to itself.
Section 1
Tours and tables of least distances
Classical and practical problems
In the classical problem, every vertex is visited exactly once. In the practical problem, vertices may be revisited if that shortens the route. Real deliveries are practical problems: passing through a town twice is fine if it saves distance.
Common mistake: counting n! tours instead of (n − 1)!/2, which counts each tour many times. A tour looks the same whichever vertex it starts from and in whichever direction it is travelled. Dividing out the starts and the 2 directions gives .
Tables of least distances
When a network is not complete, or when a direct edge is longer than an indirect route, replace each entry by the shortest distance between the two vertices. This table of least distances turns the practical problem into a classical problem on a complete network.
Why the table works
In the table, every pair of vertices is joined directly by its shortest distance. A tour in the table corresponds to a real route that may pass through other vertices. So the shortest tour in the table is the shortest practical route.
The triangle inequality
In a table of least distances, every direct distance is at most the sum of the distances through any third vertex. This property, the triangle inequality, is what makes the bounds in this chapter work as expected.
Building the table
For small networks, find each least distance by inspection, checking indirect routes. For larger networks, use Dijkstra's algorithm from each vertex, or Floyd's algorithm for all pairs at once. Record the route behind each entry so the final tour can be turned back into real roads.
Counting tours
Fix a starting vertex, since every tour passes through it. The remaining vertices can be ordered in ways. Each tour is counted twice, once in each direction, so there are distinct tours.
Derivation: the number of tours of n vertices
Fixing the start, the other vertices can be arranged in order in
ways. Reversing the order gives the same tour, so the number of distinct tours is
For five vertices this is .
How fast the count grows
Six towns give 60 tours, ten give 181 440, and fifteen give over 43 billion. Even a fast computer cannot check every tour for a few dozen towns. That is why heuristics and bounds matter.
Turning a tour into a route
If a tour uses an entry from the table of least distances, the real route follows the shortest path behind that entry. The route may pass through towns already visited. State the full route when the question asks for it.
Symmetric and asymmetric tables
All the tables in this chapter are symmetric: the distance from X to Y equals the distance from Y to X. With one-way roads the table may be asymmetric, and then a tour and its reverse have different lengths. Only symmetric tables are used in this course.
The classical problem on a practical table
Once the table of least distances is built, the practical problem is solved as a classical problem on the table. Every method in the rest of the chapter assumes this: a complete table satisfying the triangle inequality.
A sense of scale
A computer checking a billion tours a second would need over two years for twenty towns. For thirty towns it would need longer than the age of the universe. Factorial growth defeats raw computing power very quickly.
Worked example 1: counting tours
How many distinct tours are there for the five towns A to E?
| Working | Reason |
|---|---|
| Fix A as the start | Every tour passes through A |
| Order B, C, D, E in ways | Arrangements of the other four towns |
| Halve for direction: 12 tours | Reversing a tour gives the same tour |
Recording routes behind entries
Next to each entry in the table of least distances, note the path it represents, such as AD = 6 via B and C. When the final tour is found, these notes turn each step of the tour into a real route through the network.
Worked example 2: a least distance
In the network in the diagram, find the least distance from A to D and explain why it replaces the missing entry.
| Working | Reason |
|---|---|
| No direct edge from A to D | The network is not complete |
| A, B, C, D: | Shorter than A, B, D of length 10 |
| Table entry AD is 6 | The least distance between A and D |
Check yourself. How many distinct tours are there for six towns?
Show the answer
Fix the start and order the other five in ways, then halve for direction. There are 60 distinct tours.
Section 2
The nearest neighbour algorithm
The idea
The nearest neighbour algorithm builds a tour greedily. Start at any vertex. Travel to the nearest vertex not yet visited. Repeat until every vertex has been visited, then return to the start.
Common mistake: forgetting the final edge back to the start, so the length found is a path and not a tour. A tour must close up. The last step, from the final new vertex back to the start, is part of the tour and must be included in its length.
The nearest neighbour algorithm
- Tour
- A, C, D, E, B, A
- Upper bound
- 42
- Best over all starts
- 37
Figure 67.1 runs the nearest neighbour algorithm from each start. Notice how different the tours can be.
Using the table
Start in the row of the starting vertex. Find the smallest entry in a column not yet visited. Move to that vertex's row and repeat. Keep a list of visited vertices so that none is chosen twice.
Why it gives an upper bound
The algorithm always produces a genuine tour. The optimal tour is the shortest of all tours, so it can be no longer than this one. So the nearest neighbour length is an upper bound for the optimal length.
Different starts
Starting at a different vertex usually gives a different tour. Each tour gives an upper bound, and the best is the least of them. Exam questions often ask for tours from two or three starts.
Greedy choices can trap you
Choosing the nearest vertex each time can leave a long final edge. From A, the algorithm visits C, D, E and B cheaply, but then must travel 12 back to A. The greed early on is paid for at the end.
Ties
If two unvisited vertices are equally near, either may be chosen. State which one you chose, since later steps depend on it. Different choices may give tours of different lengths.
The order of the algorithm
At each step the algorithm scans one row of the table. With vertices there are steps of up to comparisons, so the work grows like . This quadratic order makes it practical for large networks.
Recording the working
Write the tour as a list of vertices, such as A, C, D, E, B, A, and beneath it the distances 4, 7, 10, 9, 12. Add them for the length. This layout makes each choice easy to check.
Nearest neighbour on a network that is not complete
If the network is not complete, apply the algorithm to the table of least distances rather than the original network. Otherwise the algorithm may reach a vertex with no unvisited neighbours and get stuck before completing the tour.
A greedy algorithm again
The nearest neighbour algorithm is greedy, like Prim's and Dijkstra's. But unlike them, it carries no guarantee of being optimal. The difference is that a tour must close up, and early cheap choices can force an expensive return.
How good is nearest neighbour?
On typical networks, nearest neighbour tours are often within about a quarter of the optimum. On some specially built networks it can do much worse. That is why its result is treated as a bound, not an answer.
Worked example 3: nearest neighbour from A
Use the nearest neighbour algorithm, starting at A, to find an upper bound.
| Working | Reason |
|---|---|
| A to C 4, C to D 7, D to E 10 | Nearest unvisited town each time |
| E to B 9, then B to A 12 | Last town, then return to the start |
| Tour A, C, D, E, B, A of length 42 | An upper bound of 42 |
Nearest neighbour as a list of decisions
Each step of the algorithm is a decision with a reason: the nearest unvisited town. Writing the reason beside each step, even briefly, shows the examiner the algorithm has been followed rather than a tour found by guesswork.
Starting at the depot
In real problems the tour usually must start at a depot, but the length of a tour does not depend on where it starts. A good tour found from another start can simply be rewritten to begin and end at the depot.
Worked example 4: starting at B
Repeat the algorithm starting at B, and state the better upper bound.
| Working | Reason |
|---|---|
| B to E 9, E to A 6, A to C 4 | Nearest unvisited town each time |
| C to D 7, then D to B 11 | Last town, then return to B |
| Length 37, better than 42 | The lower upper bound is better |
Check yourself. Starting at C, what upper bound does the nearest neighbour algorithm give?
Show the answer
From C the tour is C, A, D, E, B, C with distances 4, 5, 10, 9 and 10. Its length is 38, an upper bound of 38.
Section 3
The deleted-vertex lower bound
The idea
Take any tour and remove one vertex, say A, with its two edges. What remains is a path through every other vertex, which is a spanning tree of those vertices. So it is at least as long as their minimum spanning tree.
Common mistake: adding back only the least edge at the deleted vertex instead of the two least edges. Every tour enters and leaves the deleted vertex, using two edges there. The lower bound adds the two least edges, not one.
A lower bound by deleting a vertex
- Tree of the rest
- 24
- Two least edges
- 9
- Lower bound
- 33
Figure 67.2 deletes each vertex in turn and shows the tree of the rest together with the two least edges at the deleted vertex.
The method
Delete a vertex. Find the weight of a minimum spanning tree of the remaining vertices, using Prim's algorithm on the reduced table. Add the two least distances from the deleted vertex. The total is a lower bound.
Proof: the deleted-vertex method gives a lower bound
Let a tour of length use edges of lengths and at the deleted vertex. Removing them leaves a spanning path of the other vertices, of length at least the tree weight , so
Since is at least the sum of the two least edges at that vertex,
So is a lower bound for every tour.
Different deleted vertices
Deleting different vertices gives different lower bounds. Every one of them is valid. The best lower bound is the greatest, because it gives the tightest information about the optimal tour.
Using Prim's algorithm on the reduced table
Cross out the row and column of the deleted vertex. Apply the matrix form of Prim's algorithm to what remains. Record the edges chosen and their total, since examiners look for both.
The two least edges
Look along the row of the deleted vertex and pick the two smallest entries. These need not join the vertex to the ends of the tree. They are the cheapest possible way in and out of the deleted vertex.
When the bound is a tour
If the tree is a path, and the two least edges join the deleted vertex to its two ends, then the lower bound is itself a tour. In that case it is optimal, since no tour can be shorter than the bound.
Recording the working
State which vertex is deleted, the edges of the residual tree with their total, and the two least edges. Then add them. A short table for each deleted vertex makes the comparison easy.
Which vertex to delete
There is no rule for which deleted vertex gives the best bound. Vertices with long edges are often good candidates, because their two least edges add a lot. In an exam, delete the vertices the question names.
Lower bounds and the classical problem
The deleted-vertex argument assumes every vertex is visited exactly once, so it applies to the classical problem. On a table of least distances, the classical and practical answers agree, so the bound is valid for both.
A check on the bound
A lower bound must never exceed a known tour length. If it does, there is an arithmetic slip. With the five towns, every lower bound is at most 34, comfortably below the upper bound of 37.
Worked example 5: deleting A
Find a lower bound by deleting A.
| Working | Reason |
|---|---|
| Tree of B, C, D, E: CD 7, CE 8, BE 9, total 24 | Prim's algorithm on the reduced table |
| Two least at A: AC 4 and AD 5, total 9 | Smallest entries in row A |
| Lower bound | Tree plus the two edges |
Why the bound uses a tree, not a path
The remaining part of a tour is a path, which is a special kind of spanning tree. The minimum spanning tree might not be a path, so it can be shorter than any such path. Using the tree gives a bound that is easy to compute, at the cost of some tightness.
Lower bounds from other structures
Other lower bounds exist, such as adding up half of the two least edges at every vertex. This course uses only the deleted-vertex method, but the same idea applies: every tour has a structure that cannot be cheaper than some easily computed quantity.
Worked example 6: deleting B
Find a lower bound by deleting B.
| Working | Reason |
|---|---|
| Tree of A, C, D, E: AC 4, AD 5, AE 6, total 15 | Prim's algorithm on the reduced table |
| Two least at B: BE 9 and BC 10, total 19 | Smallest entries in row B |
| Lower bound | Better than deleting A |
Check yourself. Deleting E, what lower bound is obtained?
Show the answer
The tree of A, B, C, D has AC 4, AD 5 and BC 10, total 19. The two least edges at E are 6 and 8, total 14, so the lower bound is 33.
Upper and lower bounds in other chapters
Bounds also appeared in bin packing, where a lower bound came from dividing the total size by the bin capacity. The same logic applies here: a bound that cannot be beaten tells us how good a heuristic answer is.
Section 4
Trapping the optimal tour
Combining the bounds
The optimal length satisfies lower bound upper bound. Use the greatest lower bound and the least upper bound found. For the five towns, the best bounds give .
Common mistake: taking the least of the lower bounds as the best, when the best lower bound is the greatest. Every lower bound is true, so the greatest tells us the most. Using a smaller one throws information away and widens the interval.
Trapping the optimal tour
- This interval
- 31 ≤ L ≤ 42
- Best interval
- 34 ≤ L ≤ 37
Figure 67.3 shows the interval for each choice of start and deleted vertex. The best interval combines the greatest lower bound with the least upper bound.
Which bound is best
For upper bounds, smaller is better, because it is closer to the optimum from above. For lower bounds, larger is better, because it is closer from below. Students often mix these up under exam pressure.
Interpreting the interval
An interval of means no tour is shorter than 34, and some tour has length 37. The tour of length 37 is at most 3 km longer than the best possible, which is less than 9 per cent.
When the bounds meet
If the best lower bound equals the best upper bound, the tour giving the upper bound is optimal. This happens surprisingly often in exam questions, and you should always check for it.
Improving the bounds
To narrow the interval, try more starting vertices for the nearest neighbour algorithm and more deleted vertices for the lower bound. Each new bound can only help if it beats the current best.
Bounds on non-integer data
If distances are decimals, the bounds will be decimals too. Keep full accuracy until the end. The optimal length must lie in the interval, but it need not be a whole number.
Using bounds to make decisions
A manager may not need the exact optimum. If the best tour found is within a few per cent of the lower bound, searching further is not worth the effort. Bounds turn an impossible problem into a sensible decision.
Percentage error
The worst possible percentage error of a tour is found by comparing it with the best lower bound. A tour of 37 against a lower bound of 34 is at most , about 8.8 per cent, above the optimum.
Reporting an interval
Write the interval as an inequality, such as , and say which methods gave each bound. Examiners award a mark for the interval only if both bounds are the best ones available from the working.
Worked example 7: an interval
Using the bounds from worked examples 4 and 6, state an interval for the optimal tour length.
| Working | Reason |
|---|---|
| Least upper bound 37 | From the nearest neighbour tour from B |
| Greatest lower bound 34 | Found by deleting vertex B |
| The optimal length lies between them |
Lower bounds are not tours
A lower bound is a number, not a route. The tree plus two edges usually does not form a tour, because the tree may branch. Do not try to drive the lower bound; it only tells you that nothing shorter is possible.
Narrowing the gap
If the gap between the bounds is large, try improving the upper bound first, for example with a 2-opt swap. Upper bounds are easier to improve than lower bounds, because any shorter tour you find counts.
Worked example 8: comparing all the lower bounds
The lower bounds from deleting A, B, C, D and E are 33, 34, 31, 31 and 33. Which should be used?
| Working | Reason |
|---|---|
| All five are valid lower bounds | Each comes from the deleted-vertex method |
| The greatest is 34 | Deleting B gives the tightest bound |
| Use 34, not 31 | Larger lower bounds are more informative |
Check yourself. What is the least upper bound from the nearest neighbour tours from all five starts, which have lengths 42, 37, 38, 37 and 37?
Show the answer
The least of 42, 37, 38, 37 and 37 is 37, so the best upper bound is 37.
Section 5
Minimum spanning tree upper bounds
Doubling the tree
Walk around a minimum spanning tree, travelling each edge twice, and return to the start. This visits every vertex, so it is a valid route for the practical problem. Its length, twice the tree weight, is an upper bound.
Common mistake: treating twice the weight of a minimum spanning tree as a lower bound, when it is an upper bound. Doubling the tree gives an actual route, and any actual route gives an upper bound. The tree weight itself, without doubling, is what bounds a tour from below.
Finding the tree
Apply Prim's or Kruskal's algorithm to the whole table. For the five towns, the tree has edges AC 4, AD 5, AE 6 and BE 9, with weight 24. Doubling gives an upper bound of 48.
Shortcuts
The doubled walk revisits vertices. Replacing a path such as A, C, D by the direct edge AD skips a revisit and never increases the length, thanks to the triangle inequality. Each shortcut lowers the upper bound.
The saving from a shortcut
The saving from replacing the path X, Y, Z by the direct edge XZ is . Calculate it before using a shortcut, and choose shortcuts with large savings.
Why the bound is not usually tight
Doubling the tree uses every tree edge twice, which is wasteful. Even after shortcuts, the result is often well above the optimum. The nearest neighbour algorithm usually gives a better upper bound in practice.
A guaranteed ratio
Because a tour without one edge is a spanning tree, the tree weight is less than the optimal tour. So doubling the tree gives a route at most twice the optimal length. This guarantee is the reason the method is studied.
Practical routes
The doubled tree is a natural route for a practical problem, such as checking every branch of a pipe network. When vertices may be revisited, the walk itself is acceptable, and shortcuts are optional.
Walking round the tree
To walk round a tree, start at any vertex and trace around the outside of the tree as if it were a wall, keeping it on one side. Every edge is passed twice, once in each direction, and the walk returns to the start.
Shortcuts and the triangle inequality
A shortcut replaces a path through an already visited vertex by a direct edge. In a table of least distances, the direct edge is never longer than the path, so the shortcut never increases the length. Several shortcuts can turn the walk into a tour.
Comparing the two upper bound methods
Here the doubled tree gives 48 while the nearest neighbour algorithm gives 37. That is typical: nearest neighbour is usually better in practice, while the tree method has a guaranteed worst case.
Practical problems with repeated visits
In a practical problem, the doubled walk itself is an acceptable route even without shortcuts. A pipe inspector, for example, may need to return along a branch anyway. The method suits networks shaped like trees.
Worked example 9: doubling the tree
Find an upper bound for the five towns by doubling the minimum spanning tree.
| Working | Reason |
|---|---|
| Tree edges AC 4, AD 5, AE 6, BE 9 | Prim's algorithm on the whole table |
| Tree weight 24 | Sum of the four tree edges |
| Upper bound | Each tree edge is walked twice |
Turning the walk into a tour
Starting from A, the doubled walk around the tree might run A, C, A, D, A, E, B, E, A. Shortcutting every repeated visit leaves A, C, D, E, B, A, a genuine tour. Its length is never more than the walk, so it is also an upper bound.
Worked example 10: a shortcut
The doubled walk includes the path A, C, A, D. Find the saving from replacing C, A, D by the direct edge CD.
| Working | Reason |
|---|---|
| Path C, A, D has length | Two tree edges through A |
| Direct edge CD has length 7 | From the table of least distances |
| Saving | Shortcuts never lengthen the route |
Check yourself. Using all five towns, find the weight of their minimum spanning tree.
Show the answer
Prim's algorithm chooses AC 4, AD 5, AE 6 and BE 9, so the tree weight is 24.
Section 6
Judging and improving tours
Is a tour optimal?
A tour is proved optimal when its length equals a lower bound. Without such a bound, even a very good tour might be beaten. The nearest neighbour algorithm does not guarantee optimality, however many starts are tried.
Common mistake: concluding a tour is optimal just because it is the shortest tour found by the nearest neighbour algorithm. Heuristic tours are only upper bounds. Unless a lower bound matches, a shorter tour might still exist.
Checking a given tour
To find the length of a tour, add the distances between consecutive vertices, including the return to the start. Check that every vertex appears exactly once, apart from the start, which appears at both ends.
Improving a tour by swapping
A tour can sometimes be shortened by reversing a section of it. Replacing two edges with two others that reconnect the tour, called a 2-opt swap, is a common improvement. Each swap that saves distance gives a better upper bound.
When to stop improving
In an exam, improvement is usually limited to a step or two. In practice, computers keep improving until no single swap helps. The result is often very close to optimal, but still without a guarantee.
Checking every tour
For five or six vertices, checking every tour is possible by hand, and it proves optimality. For the five towns, checking all 12 tours shows that 37 is the least. For larger problems, this brute-force method is impractical.
Communicating the result
A good answer states the best tour found, its length, and the interval for the optimum. It then comments on how close the tour is to the lower bound. This is exactly what a manager needs to make a decision.
Brute force for small problems
For five towns, the 12 tours can be listed by fixing the start at A. Write every order of B, C, D and E, keeping B before E to avoid listing reversals. Adding each tour takes a few minutes and settles the problem completely.
Explaining limitations
Exam questions often ask why bounds are used instead of checking every tour. The answer is the factorial growth of the number of tours. Quote the formula and give a sense of how large the number becomes.
Interpreting an exam answer
When a question asks whether a tour is optimal, the safe reasoning is: compare its length with the best lower bound. If they are equal, it is optimal. If not, say the tour may or may not be optimal, and give the interval.
Worked example 11: checking a tour
Find the length of the tour A, D, C, B, E, A and comment on it.
| Working | Reason |
|---|---|
| Distances between consecutive towns | |
| Length 37 | Equal to the best upper bound found |
| Not proved optimal by the bounds alone | The best lower bound is 34 |
Heuristics in industry
Delivery companies solve huge travelling salesman problems every day using heuristics similar to those in this chapter, followed by many rounds of improvement. They rarely know the exact optimum, but lower bounds show that their routes are within a small percentage of it.
Worked example 12: a larger count
A courier must visit ten towns. How many distinct tours are there?
| Working | Reason |
|---|---|
| Fix the start, order 9 towns: | Arrangements of the other nine |
| Halve for direction: 181 440 | Reversing gives the same tour |
| Too many to check by hand | Bounds are needed in practice |
Check yourself. What is the length of the tour A, B, C, D, E, A?
Show the answer
The distances are 12, 10, 7, 10 and 6, so the tour has length 45, well above the best upper bound of 37.
Reference
Results in this chapter
| Result | What it says | When to use it | In the formula booklet? |
|---|---|---|---|
| tours | Number of distinct tours | Showing brute force is impractical | No, derive it |
| Nearest neighbour tour | An upper bound | Finding a good tour quickly | No, learn it |
| Tree of the rest + two least edges | A lower bound | Deleted-vertex method | No, derive it |
| Best LB best UB | Interval for the optimum | Judging a tour | No, learn it |
| Twice the MST weight | An upper bound | Practical problems | No, learn it |
| Saving | Shortcut | Improving the doubled tree | No, learn it |
Reasoning
Modelling task: planning a delivery round
The situation
A bakery van leaves the bakery at A each morning and delivers to four shops at B, C, D and E before returning. The table of least distances in the big idea gives the road distances in kilometres. The owner wants a short round and wants to know whether a better one might exist.
Assumptions
Each shop is visited exactly once and the van returns to A. The table gives the shortest road distance between each pair, so the classical problem on the table matches the real roads. Traffic, delivery times and opening hours are ignored.
The cost of the round is assumed to be proportional to the distance driven.
The model
The nearest neighbour algorithm from each town gives upper bounds of 42, 37, 38, 37 and 37 km. The deleted-vertex method gives lower bounds of 33, 34, 31, 31 and 33 km. So the optimal round satisfies .
Results
A round of 37 km is available, for example A, D, C, B, E, A. It is at most 3 km longer than any possible round. Checking all 12 tours confirms that 37 km is in fact the shortest.
Evaluating the model
The model gives a clear recommendation and a guarantee of quality. However, it ignores traffic, which may make some roads slower than their length suggests. Using times instead of distances would fix this.
It also ignores delivery windows: a shop that opens late might force a different order. Adding such constraints makes the problem harder, but the bounding approach still helps.
Your turn
The owner considers starting the round from B, where a new depot might be built. Which nearest neighbour round would the van follow, and what is its length?
Show a model answer
From B the van goes to E 9, A 6, C 4, D 7 and back to B 11. The round B, E, A, C, D, B has length 37 km, the same as the best round from A.
Practice
Practice ladder
Rung 1: Recall and fluency
Q1. State how many distinct tours there are for seven towns.
Worked solution to Q1
Fixing the start, the other six towns can be ordered in ways. Halving for direction gives 360 distinct tours.
Q2. Give the nearest neighbour tour from D for the five towns, and its length.
Worked solution to Q2
From D the nearest is A 5, then C 4, then E 8, then B 9, and back to D 11. The tour D, A, C, E, B, D has length 37.
Q3. Write down the lower bound obtained by deleting C.
Worked solution to Q3
The tree of A, B, D, E has AD 5, AE 6 and BE 9, total 20. The two least edges at C are 4 and 7, total 11, so the lower bound is 31.
Rung 2: Application
Q4. Find the nearest neighbour tour from E, and its length.
Worked solution to Q4
From E the nearest is A 6, then C 4, then D 7, then B 11, and back to E 9. The tour E, A, C, D, B, E has length 37.
Q5. Calculate the lower bound obtained by deleting D.
Worked solution to Q5
The tree of A, B, C, E has AC 4, AE 6 and BE 9, total 19. The two least edges at D are 5 and 7, total 12, so the lower bound is 31.
Q6. Determine the weight of the minimum spanning tree of B, C, D and E.
Worked solution to Q6
Prim's algorithm on the reduced table chooses CD 7, CE 8 and BE 9. The tree weight is .
Rung 3: Analysis
Q7. Add up the distances to find the length of the tour A, C, B, E, D, A.
Worked solution to Q7
The distances are AC 4, CB 10, BE 9, ED 10 and DA 5. Adding them gives a tour length of 38.
Q8. Use the minimum spanning tree of all five towns to find an upper bound for the practical problem.
Worked solution to Q8
The tree has weight 24. Walking round it, using each edge twice, gives a route of length , an upper bound.
Q9. Find the least distance from A to C in the four-vertex network of section 1.
Worked solution to Q9
The direct edge AC has length 8, but A, B, C has length . So the least distance from A to C is 5.
Rung 4: Stretch
Q10. A student finds the nearest neighbour tour from A but forgets to return to A. Explain the error and find the value the student would give.
Worked solution to Q10
The student adds only 4, 7, 10 and 9, giving 30, which is the length of a path, not a tour. The return edge of 12 must be included, giving the upper bound of 42.
Q11. Explain what happens if only the least edge at A is added back when A is deleted.
Worked solution to Q11
The tree weight is 24 and the least edge at A is 4, giving 28. This is still true but weaker, since every tour uses two edges at A, and the correct bound is .
Q12. A student takes 31 as the best lower bound because it is the smallest. Explain the error and give the correct interval for the optimal tour.
Worked solution to Q12
Every lower bound is valid, so the greatest, 34, is the most informative. With the best upper bound of 37, the interval is , not .
Exam practice
Exam technique and worked answer workshop
How these questions are marked
M1 marks go to applying the nearest neighbour algorithm, Prim's algorithm on the reduced table, and adding the two least edges. A1 marks go to correct tours, tree weights and bounds. B1 marks go to correct statements about which bound is best and what the interval means.
Always include the return edge in a tour, and always add two edges for a lower bound. State the final interval clearly, with the inequality the right way round.
Exam question 1 (6 marks · Paper 3 · about 8 minutes)
Use the nearest neighbour algorithm, starting at A, on the table of least distances in the big idea. State the tour, its length, and what this length tells you about the optimal tour. (6)
Mark scheme for exam question 1
A to C 4 M1
C to D 7, D to E 10 A1
E to B 9 A1
Returns B to A 12 M1
Length 42 A1
42 is an upper bound B1
Exam question 2 (6 marks · Paper 3 · about 8 minutes)
Starting at B, apply the nearest neighbour algorithm to the same table. Give the tour and its length, and state the better of this bound and the one from A. (6)
Mark scheme for exam question 2
B to E 9 M1
E to A 6, A to C 4 A1
C to D 7 A1
Returns D to B 11 M1
Length 37 A1
37 is the better upper bound B1
Exam question 3 (6 marks · Paper 3 · about 8 minutes)
By deleting A, find a lower bound for the length of the optimal tour, stating the edges of the residual minimum spanning tree. (6)
Mark scheme for exam question 3
Deletes A and uses the reduced table M1
Tree edges CD, CE, BE A1
Tree weight 24 A1
Two least edges at A: 4 and 5 M1
Sum 9 A1
Lower bound 33 A1
Exam question 4 (7 marks · Paper 3 · about 10 minutes)
By deleting B, find a second lower bound. Hence, with the upper bound from exam question 2, give the best interval you can for the length of the optimal tour, explaining your choice of bounds. (7)
Mark scheme for exam question 4
Deletes B and uses Prim's algorithm M1
Tree edges AC, AD, AE A1
Tree weight 15 A1
Two least edges at B: 9 and 10 M1
Lower bound 34 A1
A1
Greatest lower bound and least upper bound used B1
Exam question 5 (5 marks · Paper 3 · about 7 minutes)
Explain why there are 12 distinct tours of the five towns, and why checking every tour is impractical for twenty towns. (5)
Mark scheme for exam question 5
Fixes the start M1
orders A1
Halves for direction, giving 12 A1
tours for twenty towns B1
Far too many to check B1
Exam question 6 (6 marks · Paper 3 · about 8 minutes)
Find the minimum spanning tree of all five towns and hence an upper bound for the practical problem. Find the saving if the path C, A, D in the walk is replaced by the direct edge CD. (6)
Mark scheme for exam question 6
Tree edges AC, AD, AE, BE M1
Weight 24 A1
Doubles the tree M1
Upper bound 48 A1
Path C, A, D length 9 compared with CD 7 M1
Saving 2 A1
Exam question 7 (5 marks · Paper 3 · about 7 minutes)
In the four-vertex network of section 1, there is no direct edge from A to D. Explain how a table of least distances is formed, and find its entry for A and D. (5)
Mark scheme for exam question 7
Each entry is the shortest distance B1
Compares indirect routes M1
A, B, D gives 10 A1
A, B, C, D gives 6 A1
Entry 6 B1
Exam question 8 (6 marks · Paper 3 · about 8 minutes)
Calculate the total distance of the tour A, D, C, B, E, A. With the bounds found earlier, comment on whether this tour can be shown to be optimal. (6)
Mark scheme for exam question 8
Distances 5, 7, 10, 9, 6 M1
Length 37 A1
Equal to the best upper bound B1
Best lower bound 34 M1
Bounds do not meet A1
So optimality is not proved by the bounds B1
Annotated model answer: exam question 1
From A the nearest town is C, at 4. M1. From C the nearest unvisited town is D at 7, then from D it is E at 10. A1. From E the only remaining town is B, at 9. A1.
All towns are visited, so return from B to A, at 12. M1. The tour A, C, D, E, B, A has length 42. A1. This is an upper bound: the optimal tour is at most 42 km. B1.
Annotated model answer: exam question 4
Deleting B leaves A, C, D and E. Prim's algorithm chooses AC 4, AD 5 and AE 6, M1 A1, with weight 15. A1. The two least edges at B are BE 9 and BC 10, M1, so the lower bound is . A1.
With the upper bound of 37 from B, the optimal length satisfies . A1. We use the greatest lower bound and the least upper bound, since these give the narrowest interval. B1.
Connections
Synoptic link
Minimum spanning trees and shortest paths supplied both tools used here: Prim's algorithm for lower bounds and tables of least distances. Graphs, networks and planarity introduced Hamiltonian cycles, which are exactly the tours of this chapter.
Route inspection asks for a route along every edge, while this chapter asks for a route through every vertex. The first has an efficient algorithm; the second does not.
Synoptic question 1. Explain why the weight of a minimum spanning tree is always less than the length of the optimal tour.
Answer to synoptic question 1
Removing any edge from the optimal tour leaves a spanning tree, whose weight is at least the minimum spanning tree weight. So the tour is longer than the minimum spanning tree by at least one edge.
Recap
Recap and next step
- A tour visits every vertex once and returns; there are of them.
- Tables of least distances turn practical problems into classical ones.
- The nearest neighbour algorithm gives an upper bound; the least over all starts is best.
- Deleting a vertex and adding two least edges to the tree of the rest gives a lower bound; the greatest is best.
- Doubling a minimum spanning tree gives an upper bound, improved by shortcuts.
- A tour is proved optimal only when its length equals a lower bound.
Next chapter: Critical path analysis, which schedules the activities of a project to finish it as quickly as possible.
For your exam board
This chapter covers Pearson Edexcel A Level Further Mathematics (9FM0) Decision Mathematics 1 section 4: the classical and practical travelling salesman problems, tables of least distances, the nearest neighbour algorithm, minimum spanning tree methods with shortcuts for upper bounds, and the deleted-vertex method for lower bounds. It is assessed on Paper 3D, Decision Mathematics 1. Similar content appears in AQA (7367) and OCR (H245) discrete options.