Skip to main content

Summary: Branch and Bound

Everything on one page, to review the chapter before moving on.

Key ideas​

  • Branch and bound explores the same implicit tree as backtracking, but generates all the children of a node and keeps the live nodes in a data structure (The Branch and Bound Scheme).
  • With a FIFO queue it is breadth-first; with a priority queue ordered by a heuristic it is best-first, and it can jump to the most promising node at any level.
  • Bounds are optimistic estimates. A node is pruned when its bound cannot beat the best solution found so far; a good initial limit prunes from the very beginning.
  • Bounds must be optimistic, cheap and tight. With f=g+hf = g + h and an admissible hh, best-first branch and bound is the A* algorithm.
  • In the worst case it explores an exponential number of nodes, like backtracking: a good heuristic changes the practical behavior, not the theoretical complexity.

At a glance​

ProblemHeuristic / boundInitial limit
Task assignmentCost so far + minimum of each free columnCheaper diagonal
0/1 knapsackValue so far + fractional greedy completionValue of the greedy solution, or 0
Sliding puzzlesMoves made + Manhattan distanceInfinite (stop at the first goal)
Rectangle placementArea of the enclosing box so farInfinite, or any valid arrangement
N-queens(n−placed)⋅10+diagonal(n - \text{placed}) \cdot 10 + \text{diagonal}Not needed (first solution)
Traveling salesmanLength so far + cheapest exit of each remaining cityInfinite, or a greedy tour

All the problems are in Classic Problems.

Backtracking or branch and bound?​

BacktrackingBranch and bound
ExplorationDepth-firstBreadth-first or best-first
MemoryLow: O(h)O(h)High: may store an exponential number of live nodes
Best suited forEnumerating all solutions; no good heuristicOptimization with good bounds; shallow solutions
Saved only in your browser
Was this lesson helpful?
Questions, or something wrong?

Errors, suggestions and public questions open a form on GitHub, visible to everyone.