3.2 Linear Programming

DATA 442/642 · Week 3 · PDF · Slides

A linear cost, linear inequalities, and a dual that is also an LP.

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. Linear cost, linear inequalities

A linear program is the special case where J and the constraints are linear. In machine learning that is how you optimize a linear model under linear limits, and how you write some feature-selection and dimension-reduction tasks so a solver can hit the feasible set.

Level sets of a linear cost are parallel hyperplanes. Inequality constraints are half-spaces. The feasible set is a polyhedron (shaded). The min, if it exists, sits at a vertex or on a face.

Linear program: level curves and inequality half-spaces


2. The primal

minθ∈ℝd𝐜⊤θsubject toAθ≤𝐛,

with A∈ℝm×d and 𝐛∈ℝm. That is d variables and m linear constraints.


3. Dual of an LP

Lagrangian, with λ≥0,

ℒ(θ,λ)=𝐜⊤θ+λ⊤(Aθ−𝐛).

Collect terms in θ:

ℒ(θ,λ)=(𝐜+A⊤λ)⊤θ−λ⊤𝐛.

Stationarity in θ forces

𝐜+A⊤λ=0.

Then D(λ)=−λ⊤𝐛, and the dual is itself an LP with m variables:

maxλ∈ℝm−𝐛⊤λsubject to𝐜+A⊤λ=0,λ≥0.

Solve the primal if d is small. Solve the dual if m is small. Same optimal value when the LP is feasible and bounded.


4. Practice

  1. In the figure, why is the minimizer of a feasible bounded LP at a vertex (or on a face), not in the interior of the polyhedron?

  2. After forming the Lagrangian, what equation knocks θ out and leaves a dual only in λ?

  3. You have few variables and many constraints. Do you prefer the primal or the dual, and why?