Integer Programming: Branch & Bound & Cutting Planes
Integer programming extends LP by requiring some or all variables to take integer values. This single constraint transforms polynomial-time LP into an NP-hard problem — but branch-and-bound with cutting planes makes large instances tractable in practice by combining LP relaxation bounds with intelligent search.
Concepts
The feasible region of an LP is a convex polytope. The optimal solution always lies at a vertex. The objective function sweeps as a hyperplane — the last vertex it touches is optimal.
Adding a single constraint — "some variables must be integers" — transforms polynomial-time LP into NP-hard ILP. The feasible region is no longer a convex polytope but a discrete lattice of points; the LP relaxation gives a lower bound, and the gap between this relaxation and the true integer optimum determines how much search is required. Branch-and-bound uses LP bounds to prune this search, while cutting planes tighten the relaxation by slicing off fractional vertices.
ILP Formulation
A mixed-integer linear program (MILP) has the form:
When all integer variables are binary (), the problem is a binary integer program (BIP). ILP is NP-hard in general: 3-SAT reduces to BIP by encoding clauses as linear constraints.
The integrality constraint is the minimal change from LP that encodes combinatorial choice. Without it, every yes/no decision becomes a continuous dial — and the LP optimum simply sets that dial to a fraction. The formulation forces the solver to commit: a variable is either included or not, a route is taken or skipped. That commitment is what makes ILP expressive enough to encode SAT, and exactly what makes it NP-hard.
LP Relaxation and Integrality Gap
The LP relaxation drops the integrality constraints, replacing with . Let be its optimal value and the integer optimum. Then:
The integrality gap is (or for maximization). A tight LP relaxation means a small gap and a strong bound for branch-and-bound.
The LP relaxation gives the continuous optimum; integer solutions are the lattice points at vertices of the feasible region. The convex hull of all integer-feasible points is the integer hull — if we could optimize over it directly (a tighter LP), we would get the ILP optimum immediately. Cutting planes approximate the integer hull.
Branch-and-Bound
Branch-and-bound maintains a search tree where each node is an LP relaxation with additional variable bounds.
Algorithm:
- Solve the LP relaxation at the root. If the solution is integer-valued, done.
- Branch: pick a fractional variable . Create two child nodes by adding constraints (left child) and (right child).
- Bound: at each node, solve the LP relaxation. If its objective (current best integer solution), prune the subtree — no integer solution here can improve on what we have.
- Fathom: if the LP relaxation is infeasible, prune. If it gives an integer solution better than , update the incumbent.
The key insight: each node's LP relaxation lower-bounds every integer solution reachable in that subtree. Tight LP bounds lead to aggressive pruning and small trees.
Cutting Planes
A cutting plane (or cut) is a valid inequality satisfied by all integer-feasible points but violated by the current LP relaxation solution. Adding cuts tightens the LP relaxation toward the integer hull without branching.
Gomory cut: Given a row of the optimal simplex tableau corresponding to a fractional basic variable:
Write and with . The Gomory cut is:
This is valid for all integer solutions (since implies the sum is an integer, and if less than 1 it must be , contradicting ) but violated by the current LP solution where the sum equals . Wait — more precisely, the current LP solution satisfies the row equation with fractional , so the fractional parts satisfy only if are at their LP values. Any integer solution must have the left side as a non-negative integer, so at least ... or zero. Since , the cut forces which eliminates the current LP vertex.
Repeated Gomory cuts provably converge to the integer hull in finite steps, though convergence can be slow in practice. Commercial solvers use problem-specific cuts (clique cuts, cover cuts, flow cuts) alongside Gomory cuts.
Modeling Tricks
Big-M constraints encode logical implications. To force :
When , the constraint becomes , which is inactive if is large enough. Choosing too large weakens the LP relaxation; too small makes the model infeasible. A good bound from problem structure is always preferable.
Linearizing a product. To linearize with and :
These four constraints force exactly for binary .
Worked Example
0/1 Knapsack by Branch-and-Bound
Four items with weights , values , capacity .
ILP formulation:
LP relaxation (root): Solve continuously. Greedy by value/weight: item 1 (), item 2 (), item 3 (), item 4 (). Take items 1, 2 fully (weight 5), then of item 3. Objective: . is fractional.
Branch on :
- Left branch (): LP relaxation over items 1, 2, 4 with capacity 8. Take 1, 2 (weight 5), then of item 4. Obj: . Fractional .
- Branch on : left () gives integer solution , value = 7. Right (): weight constraint ; best integer: , value = . Incumbent = 10.
- Right branch (): Remaining capacity 4. LP over items 1, 2, 4. Take item 1 (weight 2), then of item 4. Obj: ; explore. Branch on : right (, weight 5 > 4, infeasible). Left (): items 1, 2 in capacity 4. Take fractional. Branch: value , prune. : weight , infeasible.
Optimal: , value = 10.
Gomory Cut
After the LP relaxation gives at the root, the simplex tableau row for is (schematically):
Here , . The Gomory cut is , i.e., , i.e., . This cut tightens the LP relaxation and eliminates the fractional solution.
Connections
Where Your Intuition Breaks
Branch-and-bound sounds like exhaustive search with pruning — but the pruning is doing almost all the work. On well-structured problems (tight LP relaxations, good incumbent solutions found early), commercial solvers prune 99.99% of the tree and solve million-variable instances in seconds. On adversarial instances (poorly-constructed Big-M models, near-integer LP relaxations with many fractional variables), the tree explodes exponentially and the same solver stalls. The misconception is that NP-hardness means "always slow in practice." It means "worst-case exponential" — and the solver's entire engineering effort goes into making the worst case rare by tightening bounds, finding incumbents early via primal heuristics, and adding cuts that eliminate fractional vertices without branching.
Complexity and Tractability
ILP is NP-hard in general, but not all instances are hard. Problem structure matters enormously:
When is the LP relaxation automatically integral? If the constraint matrix is totally unimodular (TU) — every square submatrix has determinant in — then every vertex of the LP feasible polytope is integral. Network matrices (incidence matrices of directed graphs) are TU, which is why max-flow and shortest path LPs always give integer solutions for integer data. You get integer optima from a plain LP.
| Structure | Complexity | Example |
|---|---|---|
| TU constraint matrix | Polynomial (solve LP) | Max-flow, bipartite matching |
| Fixed number of integer variables | Polynomial in data (Lenstra) | Small mixed-ILPs |
| General ILP | NP-hard | Knapsack, TSP |
| Fixed dimension | Polynomial (Lenstra-Lenstra-Lovász) | -dim ILP |
Big-M Sensitivity
Big-M constraints are a common modeling pitfall. A very large makes the LP relaxation weak — the constraint is nearly inactive even when , so the LP bound is loose and branch-and-bound explores a huge tree. Always derive the tightest valid from problem data (e.g., upper bounds on variables), or reformulate using indicator constraints that the solver handles natively.
Branch-and-Cut in Practice
Modern ILP solvers (Gurobi, CPLEX, HiGHS) use branch-and-cut: integrate cutting planes at every node of the branch-and-bound tree, not just at the root. Combined with strong branching (evaluate several candidate branching variables), primal heuristics for fast incumbents, and diving strategies, commercial solvers routinely solve instances with millions of variables and constraints in minutes — despite worst-case NP-hardness.
Enjoying these notes?
Get new lessons delivered to your inbox. No spam.