Semidefinite Programming
Some hard choices become easy one dimension up. SDP lifts vectors into matrices, trades the rank cliff for a curved cone, and bounds the original.
Why Does This Exist?
Max-Cut, community detection, and robust control are NP-hard or non-convex in native variables. Branch-and-bound dies past hundreds of nodes. SDP lifts into X = xx^\\top, drops the rank-1 cliff to , and solves the curved convex problem for a bound plus a roundable solution.
Form: minimize over , . Interior-point solves medium SDPs; first-order (ADMM, Burer-Monteiro) scales further. It generalizes linear programming from the nonnegative ray to the PSD cone within convex optimization.
The one idea you need first
means all eigenvalues nonnegative: a curved cone, self-dual, with rank-1 matrices on extreme rays. Linear functions over it stay convex; the rank constraint is the only hard part, and SDP drops exactly it.
Think of It Like This
Shadows instead of sculptures
Carving the exact statue (rank-1) is hard. The SDP sculpts the shadow instead: a larger, smooth, convex shape containing every true shadow. Then it rounds the shadow back to a statue with a certified approximation ratio.
Goemans-Williamson cuts 87.8% of optimal from the shadow. Where it stops: shadows merge distinct statues, so rounding loses the gap. Tightness must be measured per instance.
How It Actually Works
Lift binary to with ; Max-Cut becomes . Solve, factor X = V^\\top V, round with random hyperplanes: expected 0.878 of optimum. Control LMIs A^\\top P + PA \\prec 0 certify stability. Burer-Monteiro factors X = RR^\\top for large scale at the cost of non-convexity with benign landscape under rank excess.
Worked example
Triangle Max-Cut: 3 nodes, 3 edges, optimum cuts 2. SDP: ... normalized: optimum SDP value (vectors at 120 degrees, inner products ). Ratio above the 0.878 worst case. Rounding the 120-degree embedding with random hyperplanes cuts 2 edges with probability ... directly: each edge cut with probability , expected cut . Bound 2.25, rounded 2, certificate in hand.
Code
import numpy as np
inner = -0.5 # 120-degree SDP embeddingp_cut = float(np.arccos(inner) / np.pi) # edge cut probprint(round(p_cut, 3)) # -> 0.667print(round(3 * p_cut, 2)) # -> 2.0Edge probability 0.667 times 3 edges gives expected cut 2.0 against SDP bound 2.25.
Watch Out For
Rounding without measuring the gap
SDP bound 2.25 with rounded 1.5 is a 33% gap, not a certificate of near-optimality. Teams report the bound as the achievement and deploy the weak rounding.
Always report both: bound and feasible rounded value. If the gap yawns, tighten (more constraints) or round smarter.
Scaling interior-point past its weight
Dense SDPs beyond a few thousand dimensions exhaust interior-point memory ( naive). Pushing anyway swaps to disk and stalls for days.
Use ADMM, sketching, or Burer-Monteiro past medium scale. If factor iterations outrun evidence, the solver choice is the bug.
The Quick Version
- SDP lifts to , drops rank, solves the curved convex bound.
- Triangle Max-Cut: bound 2.25, rounded 2.0, ratio 0.889 above 0.878 worst case.
- Random-hyperplane rounding converts embeddings to cuts with certified expectation.
- LMIs certify control stability in the same cone.
- Report bound and rounded values together, never the bound alone.
- Scale past medium with first-order or factored methods.