Part II · trunk A · integer programming · spine
Price the hard constraints into the objective and solve what is left. Every price gives a bound; the best price gives exactly the bound you can predict in advance.
needs 03, 16~1¾ h slides + 2½ h lablab: uv run co lab 11
11 · overview
The Lagrangian function, weak duality, concavity; Geoffrion's theorem and the integrality property.
Step rules, why it is not an ascent method, and the zig-zag.
1-trees, the bound that equals the subtour LP, and what LKH does with it.
Lagrangian heuristics, and fixing variables by reduced cost.
Words with a dotted underline are glossary terms: click one for its definition. G lists every term in the unit, N shows the notes. Optional extra: interactive figures, linked from the slides they support by a small ▸ chip; skip them freely.
section 1
Move the hard constraints into the objective.
11 · dualising
$Ax \ge b$ are the complicating constraints; optimising over $X$ alone is easy. Dualise them with multipliers $u \ge 0$, giving the Lagrangian function:
$$L(u) = \min_{x \in X}\ c^\top x + u^\top (b - Ax)$$For any feasible $x$ and $u \ge 0$, $u^\top(b - Ax) \le 0$, so $L(u) \le c^\top x$. Hence $L(u) \le z$.
Equality constraints get free-sign multipliers. The GAP lab dualises "each job exactly once" with $u \in \mathbb R^n$.
$L$ is the lower envelope of the affine functions $u \mapsto c^\top x + u^\top(b - Ax)$, one per $x \in X$. So it is concave and piecewise linear, and non-differentiable exactly at its maximum.
11 · dualising · example
$L(u)$ for the example. It rises while the items bought weigh less than 5, peaks at $u = \tfrac43$, and falls once they weigh more.
Dualise the one constraint. For a price $u$ each item costs $c_j - u\,w_j$; take it if that is negative:
$$L(u) = 5u + \textstyle\sum_j \min(0,\ c_j - u\,w_j)$$$u = 1$: item costs $3-2,\ 5-4,\ 4-3 = 1, 1, 1$, all positive, buy nothing. $L = 5$. Violation $g = 5 - 0 = 5$: the price is too low.
$u = 2$: costs $-1, -3, -2$, buy all three. $L = 10 - 6 = 4$. $g = 5 - 9 = -4$: too high.
The best price, $u = \tfrac43$, gives $\tfrac{19}{3} = 6.33$, below the true optimum 7 (buy items 1 and 3).
11 · dualising
So $z_{LP} \le z_{LD} \le z$, where $z_{LP}$ also relaxes $X$ to its LP description $\bar X$.
If $\mathrm{conv}(X) = \bar X$ (the easy problem's LP has integral vertices), then $z_{LD} = z_{LP}$. The Lagrangian relaxation gives nothing the LP didn't, though it may compute it faster. The example's box $\{0,1\}^3$ is such an $X$: 6.33 both ways.
why: notes (N)
It is the same bound as Dantzig–Wolfe (unit 10), whose master convexifies $X$ explicitly.
Lab then, GAP, 300 iterations:
| m × n | opt | LP | A: knapsacks | B: one agent per job |
|---|---|---|---|---|
| 5 × 25 | 452 | 444.13 | 452.00 | 444.12 |
| 5 × 40 | 682 | 671.18 | 682.00 | 671.12 |
| 8 × 60 | 905 | 892.37 | 902.83 | 892.33 |
| 10 × 80 | 1084 | 1072.32 | 1083.71 | 1072.27 |
A leaves one knapsack per agent, which has no integrality property, so it closes 83–100% of the gap. B leaves "each job picks an agent", whose LP is integral, so it stops at the LP, as predicted.
section 2
Climbing a function with no gradient.
11 · subgradients
If $x(u)$ attains $L(u)$, then $g = b - Ax(u)$ satisfies $L(v) \le L(u) + g^\top (v - u)$ for all $v$. Computing it is free: the violation of the dualised constraints.
A subgradient step can decrease $L$, even with a tiny step. The subgradient guarantees getting closer to the optimal multipliers, not a higher value. Always keep the best bound so far.
Lab then, bound A on GAP 8 × 60, 300 iterations:
| rule | best | steps down |
|---|---|---|
| λ = 2, halve after 20 fails | 902.83 | 144 / 299 |
| λ = 2 fixed | 900.40 | 142 / 299 |
| λ = 0.1 fixed | 895.93 | 96 / 299 |
11 · subgradients · example
Polyak steps $t = \lambda\,(7 - L(u)) / g^2$, with the incumbent 7 as $\bar z$, starting at $u = 0$, on the example.
| $k$ | $u$ | $L(u)$ | $g$ | step |
|---|---|---|---|---|
| 0 | 0 | 0 | 5 | +1.4 |
| 1 | 1.4 | 6.2 | −2 | −0.4 |
| 2 | 1.0 | 5.0 | 5 | +0.4 |
| 3 | 1.4 | 6.2 | −2 | −0.4 |
Step 2 lowers $L$ from 6.2 to 5, then it repeats forever: 1.4, 1.0, 1.4, … The best bound stays 6.2.
| $k$ | $u$ | $L(u)$ | λ | best |
|---|---|---|---|---|
| 3 | 1.4 | 6.2 | 0.5 | 6.2 |
| 4 | 1.2 | 6.0 | 0.25 | 6.2 |
| 5 | 1.25 | 6.25 | 0.125 | 6.25 |
| 6 | 1.344 | 6.3125 | 0.125 | 6.3125 |
Same first three steps, then shrinking steps close in on $u = \tfrac43$, $L = 6.33$.
11 · subgradients
Every $x \in X$ you've seen gives an affine upper piece of $L$. Maximising the envelope of the pieces so far is an LP: Kelley's cutting-plane method. Its dual is unit 10's restricted master, and its columns are the $x$'s. It has the same wild oscillation that unit 10 stabilised.
Rule of thumb: subgradients for speed and simplicity with a cheap oracle; bundle or column generation when you need the exact bound or primal information.
section 3
A spanning tree, priced into a tour.
11 · Held–Karp
A 1-tree is a spanning tree on $\{1, \dots, n-1\}$ plus two edges at vertex 0. Every tour is a 1-tree with all degrees 2.
Dualise "degree = 2" with vertex penalties $\pi_v$: edge costs become $d_{ij} + \pi_i + \pi_j$, and
$$L(\pi) = \min_{T \text{ 1-tree}} \sum_{ij \in T} (d_{ij} + \pi_i + \pi_j) - 2 \sum_v \pi_v$$Subgradient: $g_v = \deg_T(v) - 2$. Raise the price of vertices with too many edges. If $g = 0$, the 1-tree is a tour, and it's optimal.
The 1-tree polytope's LP description is integral (a matroid-type polytope, unit 13), so by Geoffrion
$$\max_\pi L(\pi) = z_{\text{subtour LP}}$$| n | opt | degree LP | subtour LP | Held–Karp |
|---|---|---|---|---|
| 30 | 482 | 470.5 | 480.50 | 480.50 |
| 60 | 627 | 572.5 | 621.50 | 621.50 |
| 100 | 776 | 744.0 | 771.50 | 771.50 |
| 150 | 921 | 873.0 | 918.75 | 918.27 |
11 · Held–Karp · example
| 0 | 1 | 2 | 3 | 4 | |
|---|---|---|---|---|---|
| 0 | · | 4 | 5 | 3 | 2 |
| 1 | · | 3 | 5 | 2 | |
| 2 | · | 4 | 3 | ||
| 3 | · | 3 |
Tree on 1–4: $14$ (2), $12$ (3), $34$ (3). Plus the two cheapest edges at 0: $04$ (2), $03$ (3). Cost 13.
Degrees $(2, 2, 1, 2, 3)$, so $g = (0, 0, -1, 0, 1)$: vertex 2 is a leaf, vertex 4 a hub.
From the plain 1-tree, with $\bar z = 14$: $t = 2 \cdot (14 - 13) / 2 = 1$, so $\pi = (0, 0, -1, 0, 1)$. Edges at 2 get cheaper by 1, edges at 4 dearer by 1.
The new minimum 1-tree is the tour $0\!-\!3\!-\!2\!-\!1\!-\!4\!-\!0$, all degrees 2, length $3 + 4 + 3 + 2 + 2 = 14$. $L(\pi) = 14 = \bar z$: optimal, proved.
Force edge $13$ (length 5) into the plain 1-tree: it must replace the heaviest edge on the tree path $1\!-\!4\!-\!3$, which is 3. Cost $13 + 5 - 3 = 15 > 14$: no tour of length 14 uses edge 13. Fixed to 0. Edge $02$ is fixed the same way.
section 4
A bound is also a guide.
11 · using the multipliers
If every solution with $x_e = 1$ has Lagrangian value at least $L(u) + \rho_e$, and $L(u) + \rho_e > \bar z$, then $x_e = 0$ in every solution better than the incumbent $\bar z$.
For 1-trees: $\rho_e$ $= c_e - (\text{heaviest edge on the tree path})$, the matroid exchange of unit 13.
Lab then, with the optimum as $\bar z$: 89% / 89% / 93% / 96% of edges eliminated at $n$ = 30 / 60 / 100 / 150.
The relaxed solution violates only the dualised constraints, and often only slightly. Repair it. For GAP from relaxation A: every agent is within capacity, jobs are over- or under-assigned, so keep the cheapest copy and place the rest by regret (lab step 5).
| m × n | opt | bound A | repair |
|---|---|---|---|
| 5 × 25 | 452 | 452.00 | 452 |
| 5 × 40 | 682 | 682.00 | 682 |
| 8 × 60 | 905 | 902.83 | stuck |
| 10 × 80 | 1084 | 1083.71 | 1178 |
11 · lab
uv run co test 11
uv run co then 11 # HK vs degree LP and subtour LP · GAP bounds · the zig-zag
11 · checkpoint
Geoffrion, Math. Programming Study 2 (1974).
Held & Karp, Operations Research 18 (1970); Math. Prog. 1 (1971).
Fisher, Management Science 27 (1981).
Held, Wolfe & Crowder, Math. Prog. 6 (1974).
12 Benders decomposition, which generates constraints as unit 10 generated columns · 23 Christofides, whose analysis uses the subtour LP bound again · 26 LKH's candidate sets.