Algorithms · Branch and Bound, Puzzles and Comparison of Design Paradigms
Where this chapter sits
Backtracking (Chapter "Subset Sum and Traveling Salesman") explores the state-space tree and stops as soon as a partial solution cannot be completed. Branch and Bound (B&B) does the same tree exploration but adds a numerical bound: it computes, for every live node, the best value any completion of that node could possibly achieve, and kills the node when that bound cannot beat the best solution already found. B&B is therefore the tool for optimization problems (min/max), while backtracking is the tool for feasibility problems (find any/all solutions).
Definitions and vocabulary
| Term | Meaning |
|---|---|
| State-space tree | Tree whose root is the empty partial solution; children extend a partial solution by one decision. |
| Live node | Generated but not yet expanded. |
| E-node (expansion node) | The live node currently being expanded. |
| Dead node | Killed: (a) infeasible, (b) cannot beat the incumbent, or (c) fully explored. |
| Incumbent | Best complete solution found so far; its value is the current best . |
| Bounding function | = optimistic value of the best completion of node . |
| Pruning / fathoming | Discarding a node because its bound is not better than . |
2.1 Upper bound vs lower bound — the sign convention trap
There are two conventions in the literature and both appear in exams. Fix the language first:
- Minimization problem (TSP, assignment): we keep a lower bound = smallest cost any completion of can have. Prune when
- Maximization problem (0/1 knapsack): we keep an upper bound = largest profit any completion of can have. Prune when
Horowitz–Sahni and most GATE questions use exactly this pairing: knapsack → upper bound (fractional relaxation), TSP/assignment → lower bound (reduced cost matrix). If a question says "lower bound" for a maximization problem, it means the bound on the remaining profit, i.e. — always write the bound as "value of the whole solution through this node", never as a bare remainder, and the sign confusion disappears.
2.2 The three search strategies
| Strategy | Data structure for live nodes | Order of expansion | Memory | Notes |
|---|---|---|---|---|
| FIFO (breadth-first) | Queue | Level by level | Large (whole frontier) | Simple; no early good incumbent |
| LIFO (depth-first / D-search) | Stack | Deepest first | Same tree as backtracking; finds a leaf fast | |
| LC (least cost / best-first) | Min-heap on | Node with best bound first | Largest | Fewest nodes expanded; needs good |
LC search is the "intelligent" one: it always expands the live node with the smallest (min problem) or largest (max problem) bound. It is the B&B analogue of Dijkstra/A*.