Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Pressed against the fence
A ball rolling in an open bowl stops at the bottom, where the ground is flat. Put a fence across the bowl so the bottom is out of reach, and the ball rolls until it presses against the fence and stops there. The ground isn’t flat at that point; it still slopes downhill, but downhill points straight through the fence.
That’s the optimality condition with constraints: you’re at the best allowed point when every direction you’re allowed to move goes uphill (or stays level).
Solvers stop when an optimality test passes. Engineers use the same conditions to verify a solution, read off which constraints are binding (which actuator is saturated, which safety limit is active), and design fast special-purpose solvers.
- 1. Without constraints, a smooth convex function is minimized where its slope is…
- 2. With a fence, the ball stops where downhill points…
- 3. At a constrained optimum on the boundary, is ∇f zero?
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.Unconstrained
For differentiable convex : is a global minimizer iff . Convexity makes the first-order condition sufficient as well as necessary.
Constrained to a convex set C
minimizes a differentiable convex over iff
No feasible direction is a descent direction. This is the variational inequality.
1-D example
over . The unconstrained minimum 3 is infeasible, so and . The only feasible direction from 2 is to the left (), and . ✓
- 1. min (x − 3)² over [0, 2] is attained at…
- 2. The variational inequality says ∇f(x*)ᵀ(z − x*) is … for feasible z
- 3. For convex f, ∇f(x*) = 0 is…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 45 minUndergraduate students and practising engineers.Normal cones
The normal cone of at is . The optimality condition becomes
- Interior point: , so .
- Smooth boundary (ball): is the outward normal ray.
- Corner (box, polytope): is the cone spanned by the outward normals of the active constraints. Their coefficients are the KKT multipliers (A6.2-5).
Concrete sets
- Box : if ; if ; if .
- Non-negativity : , and (complementarity).
- Ball: if , else for .
Fixed-point form and projected gradient
is optimal iff for any . This suggests projected gradient descent, , which converges at the same rates as GD when . The gradient mapping replaces as the stopping measure.
- 1. At an interior point, the normal cone is…
- 2. For x ≥ 0, optimality requires gᵢxᵢ = …
- 3. x* is optimal iff x* = P_C(x* − η∇f(x*)). This is the…
Level 3: Advanced
★★★★☆ Advanced⏱ 40 minGraduate level, with full derivations and proofs.Proof of the variational inequality
Necessity: if for some , then (by convexity) and decreases along it for small . That’s a contradiction.
Sufficiency: by the first-order convexity inequality, . ∎
Proof of the fixed-point form
iff for all . With and , this reads , which is the variational inequality. ∎
Box conditions from the variational inequality
Take when it’s feasible. If is interior, both signs are allowed, so . At a lower bound only is allowed, giving . At an upper bound only is allowed, giving . ∎
Exercise 3.1: Project (0.5, 1.2, −0.3) onto the probability simplex
Sort: 1.2, 0.5, −0.3. Find with : gives . The result is .
- 1. Sufficiency of the variational inequality uses…
- 2. At a lower bound xᵢ = lᵢ, optimality requires gᵢ…
- 3. Projected GD with η = 1/L converges at…
Level 4: Expert
★★★★★ Expert⏱ 35 minResearchers: original papers and open problems.Unmixing a planetary spectrum
A reflectance spectrum from an orbiter is modelled as a mixture of endmember spectra (regolith, water ice, frost, basalt). Abundances must be non-negative. Unconstrained least squares often reports small negative abundances for materials that aren’t there, which is physically meaningless. Non-negative least squares by projected gradient returns zero instead. Then the optimality conditions certify the answer: the gradient is ≥ 0 everywhere, and it’s exactly 0 on every material that’s present (complementary slackness).
Optimality conditions in AI, robotics and aerospace
- Spectral unmixing for planetary and Earth remote sensing uses non-negativity and sum-to-one constraints (Keshava and Mustard, 2002; Bioucas-Dias et al., 2012).
- Actuator saturation and control allocation: the active set at the optimum tells you which actuators are saturated (Bodson, 2002).
- Projected-gradient training: constrained network weights (non-negative, norm-bounded) and adversarial training with projected attacks (PGD; Madry et al., 2018).
- Stopping criteria in solvers such as OSQP and IPOPT are scaled measures of how far the optimality conditions are from holding.
References
- S. Boyd, L. Vandenberghe (2004). Convex Optimization. Cambridge University Press. §4.2.3.
- D. Bertsekas (2016). Nonlinear Programming, 3rd ed. Athena Scientific. Ch. 2.
- R. T. Rockafellar, R. Wets (1998). Variational Analysis. Springer.
- A. Beck (2017). First-Order Methods in Optimization. SIAM. Ch. 9–10.
- C. Lawson, R. Hanson (1974). Solving Least Squares Problems. Prentice-Hall (NNLS).
- N. Keshava, J. Mustard (2002). “Spectral unmixing.” IEEE Signal Processing Magazine, 19(1).
- J. Bioucas-Dias et al. (2012). “Hyperspectral unmixing overview.” IEEE JSTARS, 5(2).
- J. Duchi, S. Shalev-Shwartz, Y. Singer, T. Chandra (2008). “Efficient projections onto the ℓ1-ball for learning in high dimensions.” ICML.
- A. Madry et al. (2018). “Towards deep learning models resistant to adversarial attacks.” ICLR.
- M. Bodson (2002). “Evaluation of optimization methods for control allocation.” Journal of Guidance, Control, and Dynamics, 25(4).