Constrained and Integer Programming

You can't build 3.5 aircraft, hire 2.7 nurses, or route 1.4 trucks. A huge share of real decisions are whole-number ones — and demanding that variables be integers turns an easy problem shockingly hard. This is integer programming (IP): a linear program with the extra rule \mathbf{x} \in \mathbb{Z}^n. That one word, "integer", is the difference between a problem solved in milliseconds and one that can defeat the world's fastest computers.

Why so hard? A linear program has a smooth, convex feasible region and its optimum sits at a corner you can walk to. The integer feasible set is instead a scatter of isolated lattice points — no convexity, no gradient to follow, nothing to slide along. Checking them one by one explodes combinatorially: with n yes/no choices there are 2^n combinations. Integer programming is NP-hard — no known algorithm solves every instance in reasonable time.

The LP relaxation: a bound for free

The key move is to relax the hard constraint. Drop the integrality rule and solve the ordinary LP — the LP relaxation. Because it optimises over a larger feasible set (all real points, not just the lattice), its optimum is at least as good as the integer one. For a maximization, that means:

(\text{integer optimum}) \;\le\; (\text{LP relaxation optimum}).

So the relaxation hands you an upper bound at the cost of one easy LP solve — an estimate of the best you could possibly hope for. (This is duality's gift again: the dual of the relaxation certifies the bound.) The catch: the relaxation's answer is usually fractional, and you cannot simply round it — the rounded point is often infeasible, or feasible but not optimal.

The picture shows a small IP. The shaded polygon is the LP feasible region; the dots are the integer feasible points. The LP relaxation peaks at a fractional corner (ringed one colour); the true integer optimum is a different lattice point entirely (ringed another). The naive "round the LP answer" point is flagged — and it lands outside the region.

Branch and bound: divide, bound, prune

The workhorse algorithm, branch and bound, turns the relaxation bound into a full search that cleverly avoids examining most of the lattice. Take the problem \max\, 5x + 4y subject to 6x + 4y \le 24, x + 2y \le 6, with x, y \ge 0 integer.

The search ends with the integer optimum (4, 0), value 20 — safely below the LP bound of 21, and reached without enumerating every lattice point. Modern solvers wrap this skeleton in extra "cutting planes" that shave fractional corners off the relaxation, but branch, bound, prune is the beating heart.

A startling number of famous puzzles are integer programs in disguise. Sudoku, the travelling salesman, airline crew scheduling, seating charts, even sports fixture lists — all become "choose these 0/1 variables to satisfy the rules". Because IP is NP-hard, this cuts both ways: it means one general solver can attack an enormous variety of problems, but also that a big enough instance may be genuinely intractable. The travelling salesman problem — visit every city once at least cost — is the poster child: trivial to state, and a benchmark that has driven decades of algorithmic ingenuity precisely because brute force (checking all n! tours) is hopeless past a few dozen cities.