3.1 Constrained Optimization

DATA 442/642 · Week 3 · PDF · Slides

Lagrange multipliers, the primal, and the dual.

These notes walk through the lecture slides. The original deck is unchanged; use (slides) on the course hub if you want that PDF.

The figures follow Deisenroth, Faisal, and Ong, Mathematics for Machine Learning.

1. Extra conditions on θ

Unconstrained: minθJ(θ) with J:ℝl→ℝ. Constrained: the same min, plus real-valued gi that θ must obey,

minθJ(θ)subject togi(θ)≤0,i=1,…,m.

The feasible set can mix equalities and inequalities:

S={θ:gi(θ)=0 or gi(θ)≤0}.

J and the gi need not be convex. The LP and QP notes take the convex case.

A box −1≤θj≤1 is already a constraint set. The unconstrained min can fall outside the box. The constrained min is then on the boundary (the star, not the circle).

Unconstrained min versus a box constraint


2. The primal

The primal is the original problem in θ: minimize J subject to gi(θ)≤0. Its solution is the feasible θ you actually want, and the optimal J. Direct search can be ugly once the constraints or J are messy.

Why turn it into an unconstrained problem in more variables?

Reason What you get
Simplicity Most solvers are written for unconstrained maps
Algorithms You can use methods from Week 2
Theory Stationarity and convergence statements are cleaner
Hard problems Nonlinear / nonconvex constraints become a Lagrangian you can differentiate

3. The Lagrangian

For inequalities gi(θ)≤0,

ℒ(θ,λ)=J(θ)−∑i=1mλigi(θ)=J(θ)−λ⊤𝐠(θ),

with multipliers λ∈ℝm. (Sign conventions differ across books; stay consistent with the slide that introduced gi.)

Stationarity of the Lagrangian:

∇θℒ(θ,λ)=0,∇λℒ(θ,λ)=0.

A multiplier is the rate of change of J if you nudge the corresponding constraint. It is the price of that constraint.


4. The dual

Minimize ℒ in θ first (when that min is easy). What remains is a function of λ:

D(λ)=minθℒ(θ;λ).

The Lagrange dual is

maxλ∈ℝmD(λ)subject toλ≥0.
What the dual gives you Why it matters
A lower bound on the primal min You can score a candidate θ
Multipliers as sensitivities How much J moves if a constraint moves
Sometimes a cheaper solve Dual decomposition, cutting planes; m vs l can flip which problem is small

5. SVM as a constrained problem

Soft-margin SVM is already in this shape:

minθ∈ℝl&12‖θ‖2+C∑n=1Nξnsubject to&yn(xn⊤θ+b)≥1−ξn,ξn≥0.

Maximum-margin hyperplane

Form the Lagrangian, pass to the dual, and the multipliers become the story of which points sit on the margin. Notes 3.2 and 3.3 write the same move for an LP and a QP. Week 5 returns to this primal.


6. Practice

  1. What does a Lagrange multiplier charge you for?

  2. In the box-constraint picture, why can the star (constrained min) differ from the circle (unconstrained min)?

  3. Why might you solve the dual instead of the primal, even though the primal is the problem you stated?