Module II·Article III·~5 min read

Linear, Quadratic, and Semidefinite Programming

Duality and Optimality Conditions

Reading tools · save, download, print, audio

Turn this article into a podcast

Pick voices, format, length — AI generates the audio

Hierarchy of Convex Problems

Convex programming is a "family" of optimization problems of varying complexity. Linear programming (LP) is the simplest: linear objective, linear constraints. Quadratic programming (QP) involves a quadratic objective. Second-order cone programming (SOCP) has conic constraints. Semidefinite programming (SDP) has matrix constraints. Each subsequent class strictly generalizes the previous one. Understanding this hierarchy allows one to choose the right tool for a specific problem.

Linear Programming (LP)

Standard form: min cTxc^\mathrm{T}x subject to Ax≤bAx \leq b, x≥0x \geq 0.

Here c∈Rnc \in \mathbb{R}^n is the vector of objective coefficients, A∈Rm×nA \in \mathbb{R}^{m \times n} is the constraint matrix, b∈Rmb \in \mathbb{R}^m is the right-hand sides.

Geometry: the feasible region is a convex polyhedron (polytope). The linear objective function attains its minimum at a vertex of the polyhedron. The simplex method (Dantzig, 1947) "moves" from vertex to vertex until it finds the optimum. The interior point method moves through the interior.

Duality in LP: the primal problem min cTxc^\mathrm{T}x subject to Ax≥bAx \geq b, x≥0x \geq 0 has a dual max bTyb^\mathrm{T}y subject to ATy≤cA^\mathrm{T}y \leq c, y≥0y \geq 0. Strong duality always holds (if both problems are feasible).

Example — Diet Problem: minimize the cost of a set of products while ensuring sufficient nutrients. This is a classic LP problem, solved back in the 1940s.

Quadratic Programming (QP)

Standard form: min (1/2)xTPx+qTx(1/2)x^\mathrm{T}Px + q^\mathrm{T}x subject to Ax≤bAx \leq b

P∈Rn×nP \in \mathbb{R}^{n \times n} is the matrix for the quadratic term; it must be ⪰0\succeq 0 (positive semidefinite) for the problem to be convex.

Why ⪰0\succeq 0? The quadratic form xTPxx^\mathrm{T}Px is convex if and only if P⪰0P \succeq 0. Criterion: all eigenvalues are ≥0\geq 0.

Application: Markowitz Portfolio Optimization

Given a set of assets with expected returns μi\mu_i and a covariance matrix Σ\Sigma. The problem: minimize risk wTΣww^\mathrm{T}\Sigma w subject to achieving a target return μTw≥r∗\mu^\mathrm{T}w \geq r^* and a budget constraint Σwi=1\Sigma w_i = 1.

min (1/2)wTΣw(1/2)w^\mathrm{T}\Sigma w subject to μTw≥r∗\mu^\mathrm{T}w \geq r^*, 1Tw=11^\mathrm{T}w = 1, w≥0w \geq 0

This is QP! The covariance matrix Σ\Sigma is inherently ⪰0\succeq 0.

Application: SVM

min (1/2)∥w∥2(1/2)\|w\|^2 subject to yi(wTxi+b)≥1y_i(w^\mathrm{T}x_i + b) \geq 1 — strictly convex QP with a unique solution.

Second-Order Cone Programming (SOCP)

SOCP constraint: ∥Aix+bi∥≤ciTx+di\|A_i x + b_i\| \leq c_i^\mathrm{T}x + d_i — the norm of a vector is bounded by a linear function of xx.

Geometrically: the feasible set is the intersection of second-order cones and affine subspaces.

Includes LP and QP: LP is a special case (when Ai=0A_i = 0, degenerates to linear). QP with P⪰0P \succeq 0 allows an SOCP formulation.

Example: Robust Linear Programming

Suppose we have LP, but the matrix A=Aˉ+δAA = \bar{A} + \delta A contains an error. Problem: min cTxc^\mathrm{T}x subject to (Aˉ+δA)x≤b(\bar{A} + \delta A)x \leq b for all ∥δA∥F≤ρ\|\delta A\|_F \leq \rho.

Robust constraint: AˉiTx+ρ∥xi∥≤bi\bar{A}_i^\mathrm{T}x + \rho\|x_i\| \leq b_i — this is an SOCP constraint!

Semidefinite Programming (SDP)

SDP problem: min⁡Xtr(CX)\min_{X} \mathrm{tr}(CX) subject to tr(AiX)=bi\mathrm{tr}(A_i X) = b_i, i=1,...,mi=1,...,m, X⪰0X \succeq 0

where XX is a symmetric n×nn \times n matrix, X⪰0X \succeq 0 means positive semidefinite.

Variable — matrix XX! This generalizes LP (variable — vector xx) to the matrix case.

Why is this a convex problem? The set of ⪰0\succeq 0 matrices is a convex cone. The objective function tr(CX)\mathrm{tr}(CX) is linear.

Complete Analysis: SDP Relaxation of the MAX-CUT Problem

Problem: graph G=(V,E)G = (V, E). Partition the vertices into two sets SS and V∖SV \setminus S, maximizing the number of edges between them.

ILP formulation: xi∈{−1,+1}x_i \in \{-1, +1\}. Cut: (1/4)∑(i,j)∈E(1−xixj)(1/4)\sum_{(i,j)\in E} (1 - x_i x_j). NP-hard.

SDP relaxation (Goemans-Williamson, 1995): replace xi∈{±1}x_i \in \{\pm 1\} by vectors vi∈Rnv_i \in \mathbb{R}^n with ∥vi∥=1\|v_i\| = 1. Product xixj→x_i x_j \rightarrow scalar product viTvjv_i^\mathrm{T} v_j. Matrix Yij=viTvj⪰0Y_{ij} = v_i^\mathrm{T} v_j \succeq 0!

max (1/4)∑(i,j)∈E(1−Yij)(1/4)\sum_{(i,j)\in E}(1 - Y_{ij}) subject to Yii=1Y_{ii} = 1, Y⪰0Y \succeq 0

Solution: this is SDP! Randomized rounding (random hyperplane) yields a 0.8780.878-approximation of MAX-CUT.

What does this mean: the algorithm is guaranteed to find a cut constituting at least 87.8%87.8\% of the optimum. This is the best known polynomial algorithm.

Solvers

In practice, problems are solved by specialized packages:

  • CVXPY (Python): high-level language for describing problems
  • MOSEK: commercial, very fast for LP/QP/SOCP/SDP
  • SCS: open, scalable for large SDP
  • ECOS: efficient for embedded systems

Example in CVXPY: x = cp.Variable(n); prob = cp.Problem(cp.Minimize(0.5*cp.quad_form(x,P) + q.T@x), [A@x <= b]); prob.solve()

Hierarchy of Problem Classes

There exists a natural hierarchy of convex conic programs by expressive power and complexity: LP⊂QP⊂SOCP⊂SDPLP \subset QP \subset SOCP \subset SDP

Each subsequent class is strictly more powerful: SDP can express SOCP via standard embedding, SOCP includes QP with positive semidefinite matrices, QP includes LP. Complexity also increases: LP solved in O(n3.5)O(n^{3.5}) by simplex or interior point, QP in O(n3)O(n^3), SOCP in O(n3.5)O(n^{3.5}), SDP in O(n6.5)O(n^{6.5}) for general problems, though structured ones may be much faster.

Industrial Solvers

  • LP: Gurobi, CPLEX, MOSEK, HiGHS (open source) — millions of variables in seconds
  • QP: OSQP, qpOASES (for real-time control), Gurobi
  • SOCP: ECOS, MOSEK, SCS — widely used in finance for robust portfolios
  • SDP: SDPT3, SeDuMi, MOSEK, COSMO — for problems up to several thousand variables
  • Universal modeling languages: CVXPY, JuMP, YALMIP — allow writing the problem in natural form and automatically reducing to canonical for the solver

Modern Applications

  • LP in aviation: American Airlines solves problems with millions of variables for crew assignments
  • QP in robotics: quadratic regulators (LQR) and MPC (Model Predictive Control) — foundation for controlling manipulators and quadcopters
  • SOCP in finance: Goldfarb-Aiyengar robust portfolios account for uncertainty in return estimates using ellipsoidal sets
  • SDP in quantum computing: quantum tomography problems, estimation of quantum channels are formulated via SDP
  • SDP in combinatorics: Goemans-Williamson’s MAX-CUT relaxation yields a 0.8780.878-approximation via SDP — a record in theoretical computer science

§ Act · what next