Minimize a quadratic objective with linear constraints — the natural home of least-squares problems.
A quadratic program (QP) minimizes a quadratic objective subject to linear constraints:
QPs arise naturally whenever you fit a model to data with constraints — regression with non-negativity, portfolio optimization with budget limits, support vector machines.
Without constraints, minimizing ||Ax − b||² has the closed-form solution via the normal equations:
Using the singular value decomposition A = UΣV>, the solution can also be written as x* = VΣ−1U>b, which is numerically more stable.
Adding inequality constraints Cx ≥ d to the least-squares problem prevents the closed-form solution. The strategy is to first remove any equality constraints via the LQ decomposition (reducing the number of variables), then solve the remaining problem with inequalities only.
The equality constraints Ex = f reduce the degrees of freedom. After an LQ decomposition of E, some variables are determined by the constraints and only the remaining "free" variables need to be optimized subject to the inequalities.
A least distance program finds the point closest to the origin that satisfies linear inequalities:
Any least-squares problem with inequalities can be transformed into this form through the SVD-based change of variables z = T·vfixed − U1>b. The key: rewrite the objective so the "target" is the origin, and the inequalities constrain which region you can search.
The final link in the chain: nonnegative least squares (NNLS) minimizes ||Ex − f|| subject to x ≥ 0. The NNLS problem has an elegant active-set algorithm:
The Lawson-Hanson algorithm for NNLS maintains a passive set P (variables free to be positive) and a zero set Z (variables forced to zero). At each step:
1. Compute the gradient w = E>(f − Ex). If all gradient components for Z-variables are ≤ 0, the solution is optimal.
2. Otherwise, move the Z-variable with the most positive gradient into P.
3. Solve the unconstrained least squares on P. If any resulting value is negative, interpolate back to feasibility and move that variable to Z.
As with linear programs, we can verify QP solutions using dual certificates. The KKT conditions for a QP provide the necessary conditions. For an NNLS solution x*:
1. Feasibility: x* ≥ 0
2. Complementary slackness: xi* · wi = 0 for all i
3. Stationarity: w = E>(f − Ex*) ≤ 0 for zero-set variables
| Problem | Converts To | Method |
|---|---|---|
| General QP | Least squares + inequalities | LQ decomposition |
| LS + inequalities | Least distance program | SVD change of variables |
| Least distance | NNLS | Dual transformation |
| NNLS | (solved directly) | Lawson-Hanson active set |
| Concept | Key Fact |
|---|---|
| Quadratic programs | Quadratic objective + linear constraints; convex when PSD |
| Unconstrained LS | Closed form via normal equations or SVD |
| Reduction chain | QP → LS+ineq → least distance → NNLS |
| NNLS | Active-set method; finite convergence guaranteed |
| Dual certificates | KKT conditions verify optimality independently |