Contents · Convex Optimization
Part 0 · Convexity
Part 1 · Quadratic Programs
Part 2 · Duality
- Duality and the KKT Conditions
Part 3 · Cones
Part 4 · Descent
Part 2 · Duality
Duality and the KKT Conditions
Every inequality constraint carries a shadow price. It stays zero while the constraint is slack and turns on the instant the constraint binds. Those prices are the dual variables, and at an optimum they and the primal solution satisfy the KKT conditions. In physics the same prices come back with a physical name: they are the constraint forces that hold contacts and joints together.
The Lagrangian and the dual
Take the problem subject to for . Fold the constraints into the objective with one multiplier each:
Each charges a penalty proportional to the violation . Minimizing over for a fixed price vector gives the dual function
For any feasible (so ) and any , the penalty sum is nonpositive, hence and
Taking the infimum over feasible gives weak duality, , where is the primal optimum. The dual problem sharpens this lower bound, . The difference is the duality gap. When and the are convex and a strictly feasible point exists (Slater's condition), the gap closes: , which is strong duality.1
The KKT conditions
At a primal-dual optimum under strong duality, four conditions hold together:
Complementary slackness is the hinge. For each constraint either (tight, and it may carry a positive price) or (slack, and its price vanishes), never both. Stationarity reads geometrically: is a nonnegative combination of the active constraint gradients, so the steepest-descent direction is exactly cancelled by the constraints that push back. For convex programs these four conditions are not only necessary but sufficient for optimality.
A worked example
Minimize subject to , written as . The gradients are
Stationarity gives and . Complementary slackness leaves two branches. If then , but is infeasible, so that branch is rejected. The other branch takes the constraint active, :
Dual feasibility and primal feasibility both check, so this is the optimum. The dual confirms it. Minimizing over at gives
which is maximized at with . The gap is zero: strong duality holds.
objective bowl + feasible halfspace (drag to move c)
- c (uncon. min)
- (0.00, 0.00)
- x* (optimum)
- (0.50, 0.50)
- g(x*) = 1−x1−x2
- 0.00
- μ (multiplier)
- 0.50
- μ · g(x*)
- 0.00 = 0
constraint active: g(x*) = 0, μ > 0. −∇f (dark) lies along ∇g (yellow), so −∇f = μ∇g.
Complementary slackness forces μ·g(x*) = 0: either the constraint is tight and priced (μ > 0), or slack and free (μ = 0). Never both.
Constraint forces are the multipliers
In rigid-body dynamics the nonpenetration constraint at contact is , where is the gap. Its multiplier is nothing other than the normal contact force (or impulse) , and the three complementarity pieces of KKT read as physical laws:
Dual feasibility is one-sidedness: a contact pushes and never pulls. Complementary slackness is the Signorini condition: a force acts only when the gap is closed. Stationarity is the equation of motion, with each constraint force acting along the surface normal and scaled by its multiplier. So the geometric statement from the demo, that the multiplier scales the constraint normal, is literally the statement that a contact force points along the normal with magnitude set by how hard the constraint is pressed. KKT is the optimization face of the same complementarity that governs contact.
Footnotes
-
Boyd & Vandenberghe, Convex Optimization (2004). ↩