AI Search · Exam notes
Every paper carries one TSP Branch and Bound comprehension with four sub-questions. The tree is given, the algorithm is frozen, and every answer is read off the tree. The four questions are always: which nodes are refined next? which node is the optimal tour and its cost? how many cities? what is the tour from A? All five trees on this page are real trees from past papers, with official answers. These notes teach exactly that skill, nothing more.
TSP: visit every city exactly once and return to the start, minimising total cost. Input is a cost matrix. A tour on \(n\) cities uses exactly \(n\) edges.
Example cost matrix (symmetric)
| A | B | C | D | |
|---|---|---|---|---|
| A | - | 10 | 15 | 20 |
| B | 10 | - | 35 | 25 |
| C | 15 | 35 | - | 30 |
| D | 20 | 25 | 30 | - |
Solved mini-example. Tour A,B,D,C,A costs 10 (AB) + 25 (BD) + 30 (DC) + 15 (CA) = 80. Tour A,C,B,D,A costs 15 + 35 + 25 + 20 = 95. So the first is better. Every TSP question below is this same comparison, scaled up and organised by the search tree.
The search space here is not a map. It is a refinement space: the root node S0 is the set of all possible tours. Refining a node means splitting its tour set in two using one edge: one child includes the edge (label XY), the other excludes it (label ¬XY; the question text writes it as ~XY).
Each node carries a cost = lower bound on the best tour inside its set. A lower bound never overestimates: every tour in that set costs at least the bound. The algorithm is one line:
Always refine the unrefined leaf with the smallest cost. Stop when that leaf is a fully refined single tour. At that point no other leaf can beat it, because every other leaf only promises a bound at or above its actual cost.
Solved mini-example. Leaves: b1 (cost 218), b2 (cost 235). Refine b1: it promises the cheaper set. Its children c1 (250), c2 (222) join the leaves. Now leaves are b2 (235), c1 (250), c2 (222). Refine c2. That is the whole algorithm, repeated.
Every node in the exam tree shows three things:
Solved mini-example. Node "b1, AD, 224" reads: first-level node, every tour here includes edge AD, cheapest such tour costs at least 224. If another leaf also shows 224, say b2, refine b1 first (b1 comes first alphabetically).
4a. The tree as a table (solve from this, then check the animation)
| Ref | Edge | Cost | Children |
|---|---|---|---|
| a1 | S0 (all tours) | 224 | b1 (AD), b2 (¬AD) |
| b1 | AD | 224 | c1 (BD), c2 (¬BD) |
| b2 | ¬AD | 244 | c3 (BD), c4 (¬BD) |
| c1 | BD | 276 | - |
| c2 | ¬BD | 242 | d1 (BC), d2 (¬BC) |
| c3 | BD | 244 | d3 (BC, tour), d4 (¬BC) |
| c4 | ¬BD | 270 | - |
| d1 | BC | 242 | e1 (AC), e2 (¬AC) |
| d2 | ¬BC | 340 | - |
| d3 | BC, tour A-C-B-D-E-A | 244 | - |
| d4 | ¬BC | 255 | - |
| e1 | AC | 268 | - |
| e2 | ¬AC, tour A-D-C-B-E-A | 249 | - |
Cover the animation below. Starting from a1, list each refinement by picking the cheapest unrefined leaf, then find the cheapest complete tour. Official answers: b1,c2,d1,b2; d3,244; 5; A,C,B,D,E.
4b. Animation: the full tree, highlighted step by step
The animation below hides nothing: every node is visible from the start. Stepping forward only marks progress. Black means refined, outline means refining right now, grey means the two new leaves that refinement has just produced, thick border at the end means the optimal tour. The ¬ sign marks exclusion (the question text writes ~AD): ¬AD means the edge AD is excluded.
Why this refinement
Unrefined leaves at this step
4c. Full question
The TSP Branch and Bound algorithm is solving a TSP instance with cities A, B, C, and so on. The search tree at the time the algorithm has discovered the optimal tour is shown below. Each node displays an edge (either XY or ¬XY), a cost value, and a unique reference number (a1, b1, b2, c1, c2, c3, c4, d1, d2, d3, d4, e1, e2). Use the reference numbers to break ties.
4d. Step by step solution
Each tree below is a real past paper tree. For each one, answer all four sub-questions with a pen, then open the answer. Rule throughout: refine the min-cost unrefined leaf, ties by reference number.
| Ref | Edge | Cost | Children |
|---|---|---|---|
| a1 | S0 | 196 | b1 (BC), b2 (¬BC) |
| b1 | BC | 196 | c1 (BD), c2 (¬BD) |
| b2 | ¬BC | 230 | c3 (BD), c4 (¬BD) |
| c1 | BD | 232 | - |
| c2 | ¬BD | 236 | - |
| c3 | BD | 230 | d1 (AD, tour), d2 (¬AD) |
| c4 | ¬BD | 310 | - |
| d1 | AD, tour A-C-E-B-D-A | 230 | - |
| d2 | ¬AD | 271 | - |
Q: 2nd to 4th refined? Optimal node and cost? Cities? Tour from A?
Why this refinement
Unrefined leaves at this step
b1,b2,c3; d1,230; 5; A,C,E,B,D. Trace: a1 first. Leaves b1 (196), b2 (230): 2nd is b1. It makes c1 (232), c2 (236). Leaves b2 (230), c1 (232), c2 (236): 3rd is b2. It makes c3 (230), c4 (310). Leaves c3 (230), c1 (232): 4th is c3. It makes d1 (230, tour) and d2 (271). Cheapest fully refined leaf is d1 (230). Path a1, b2 (¬BC), c3 (BD), d1 (AD) forces AC, CE, EB: tour A,C,E,B,D. Reverse A,D,B,E,C also accepted.
| Ref | Edge | Cost | Children |
|---|---|---|---|
| a1 | S0 | 131 | b1 (BC), b2 (¬BC) |
| b1 | BC | 131 | c1 (AC), c2 (¬AC) |
| b2 | ¬BC | 167 | - |
| c1 | AC | 176 | - |
| c2 | ¬AC | 162 | d1 (BD, tour), d2 (¬BD) |
| d1 | BD, tour A-D-B-C-E-A | 162 | - |
| d2 | ¬BD | 198 | - |
Q: 2nd to 4th refined? Optimal node and cost? Cities? Tour from A?
Why this refinement
Unrefined leaves at this step
b1,c2,d1; d1,162; 5; A,D,B,C,E. Trace: a1 first. Leaves b1 (131), b2 (167): 2nd is b1. It makes c1 (176), c2 (162). Leaves c2 (162), b2 (167), c1 (176): 3rd is c2. It makes d1 (162, tour) and d2 (198). Leaves d1 (162, tour), b2 (167): 4th is d1, which is already the complete tour, so it is optimal on the spot. Path a1, b1 (BC), c2 (¬AC), d1 (BD) forces AD, CE, EA: tour A,D,B,C,E. Reverse A,E,C,B,D also accepted.
| Ref | Edge | Cost | Children |
|---|---|---|---|
| a1 | S0 | 380 | b1 (DE), b2 (¬DE) |
| b1 | DE | 380 | c1 (BC), c2 (¬BC) |
| b2 | ¬DE | 422 | - |
| c1 | BC | 380 | d1 (BE), d2 (¬BE) |
| c2 | ¬BC | 406 | - |
| d1 | BE | 395 | e1 (AD), e2 (¬AD, tour) |
| d2 | ¬BE | 398 | e3 (BD), e4 (¬BD) |
| e1 | AD | 454 | - |
| e2 | ¬AD, tour A-C-B-E-D-F-A | 402 | - |
| e3 | BD | 434 | - |
| e4 | ¬BD | 428 | - |
Q: 2nd to 5th refined? Optimal node and cost? Cities? Tour from A?
Why this refinement
Unrefined leaves at this step
b1,c1,d1,d2; e2,402; 6; A,C,B,E,D,F. Trace: a1 first. Leaves b1 (380), b2 (422): 2nd is b1. It makes c1 (380), c2 (406). Leaves c1 (380), c2 (406), b2 (422): 3rd is c1. It makes d1 (395), d2 (398). Leaves d1 (395), d2 (398): 4th is d1. It makes e1 (454), e2 (402, tour). Leaves d2 (398), e2 (402), c2 (406): 5th is d2. It makes e3 (434), e4 (428). Fully refined leaves: e2 (402), e4 (428), e3 (434), e1 (454). Cheapest is e2 (402). Path a1, b1 (DE), c1 (BC), d1 (BE), e2 (¬AD) forces AC, CB, DF, FA: tour A,C,B,E,D,F. Six distinct cities. Reverse A,F,D,E,B,C also accepted.
| Ref | Edge | Cost | Children |
|---|---|---|---|
| a1 | S0 | 375 | b1 (BD), b2 (¬BD) |
| b1 | BD | 375 | c1 (CD), c2 (¬CD) |
| b2 | ¬BD | 414 | c3 (CD), c4 (¬CD) |
| c1 | CD | 418 | d1 (AB), d2 (¬AB) |
| c2 | ¬CD | 410 | d3 (AB, tour), d4 (¬AB) |
| c3 | CD | 414 | d5 (AB), d6 (¬AB) |
| c4 | ¬CD | 452 | - |
| d1 | AB | 456 | - |
| d2 | ¬AB | 548 | - |
| d3 | AB, tour A-B-D-E-C-A | 434 | - |
| d4 | ¬AB | 468 | - |
| d5 | AB | 414 | e1 (AD), e2 (¬AD) |
| d6 | ¬AB | 572 | - |
| e1 | AD | 436 | - |
| e2 | ¬AD | 472 | - |
Q: 2nd to 5th refined? Optimal node? Optimal cost? Cities? Tour from A?
Why this refinement
Unrefined leaves at this step
b1,c2,b2,c3; d3; 434; 5; A,B,D,E,C. Trace: a1 first. Leaves b1 (375), b2 (414): 2nd is b1. It makes c1 (418), c2 (410). Leaves c2 (410), b2 (414), c1 (418): 3rd is c2. It makes d3 (434, tour), d4 (468). Leaves b2 (414), c1 (418): 4th is b2. It makes c3 (414), c4 (452). Leaves c3 (414), c1 (418): 5th is c3. It makes d5 (414), d6 (572). Then d5 (414) is refined into e1 (436), e2 (472). Fully refined leaves: d3 (434), e1 (436), d4 (468), e2 (472), d6 (572). Cheapest is d3 (434). Path a1, b1 (BD), c2 (¬CD), d3 (AB) forces DE, EC, CA: tour A,B,D,E,C. This paper asked node and cost separately (Q70: d3, Q71: 434).