Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

10. Quadratic Programming

Quadratic programming solves a convex quadratic objective under linear constraints. The quadratic module of nlopt4r provides an active-set method, a phase-I feasible-point search and a direct KKT solve for equality-constrained models.

10.1 Model

The model form is

$$ \min_x\ \tfrac12 x^\top Hx+c^\top x \quad\text{s.t.}\quad A_e x=b_e,\quad A_i x\ge b_i, $$

with \(H\) symmetric positive semidefinite, checked against the threshold

$$ \lambda_{\min}(H)\ge-10^{-10}\,(1+\|H\|). $$

The solve entry validates finiteness and shapes of all arrays; an absent constraint matrix has shape \(0\times n\).

10.2 KKT system and active set

Given the active set \(\mathcal A\) (equality rows and active inequality rows), the KKT system is

$$ \begin{bmatrix} H & -A_{\mathcal A}^\top\\ A_{\mathcal A} & 0 \end{bmatrix} \begin{bmatrix} d\\ \nu \end{bmatrix} = \begin{bmatrix} -c-Hx\\ b_{\mathcal A}-A_{\mathcal A}x \end{bmatrix}. $$

The active-set iteration:

  1. solve the KKT system for the step \(d\) and multipliers \(\nu\);
  2. check inequality rows along \(d\): a blocking row (\(A_i(x+\alpha d)=b_i\) reached first) joins the active set;
  3. with no blocking row, update \(x\); check inequality multiplier signs and drop rows with negative multipliers;
  4. terminate when the working set is stable and all conditions hold, judged by the KKT tolerance.

Equality multipliers and inequality multipliers are reported separately; inequality rows outside the active set carry zero multiplier.

Figure 10-1 Feasible set \(x_1\ge0\), \(x_2\ge0\), \(x_1+x_2\le3\) with objective \(\tfrac12\lVert x-(3.4,1.2)\rVert^2\): the step from \(x^0\) meets the blocking constraint \(x_1+x_2=3\) at the blocking point, which joins the active set, and the iterate then moves along the constraint to \(x^*=(3,0.8)\); thin lines are objective contours. Section 11.2 of the textbook gives the step formula and algorithm of the active-set method.

10.3 Phase I

When the initial point is infeasible, phase I solves the auxiliary problem with a scalar \(t\):

$$ \min\ t \quad\text{s.t.}\quad A_e x=b_e,\quad A_i x+t\ge b_i,\quad t\ge0, $$

starting from \(t=\text{violation}(x_0)+1\). After the auxiliary problem converges, \(t\le\tau_g\) marks the original problem as feasible, and the first \(n\) components of the phase-I solution start the main solve. Exhausted auxiliary iterations or \(t\) above tolerance return Infeasible or the corresponding error.

Each phase uses StopOptions::max_iterations and the phases share the strict objective budget max_evaluations. Reported iteration counts cover the main solve.

10.4 Singular and redundant systems

Linear systems are solved in this order:

  1. square systems try full-pivot LU; a residual within \(10^{-10}(1+|b|)\) accepts that solution;
  2. remaining cases use the SVD minimum-norm solution with truncation threshold \(10^{-12}\max(|A|,1)\);
  3. a solution residual above \(10^{-7}(1+|b|)\) returns SingularSystem.

This order covers redundant consistent constraints, rank-deficient KKT matrices and inconsistent systems; unbounded flat directions and general linear programs surface explicitly as SingularSystem or Infeasible.

10.5 Direct equality-constrained solve

quadratic::equality_constrained(h, c, a, b) assembles one KKT system for an equality-constrained model and solves it:

  • returns QuadraticSolution with an iteration count of 1;
  • reported multipliers satisfy \(Hx+c-A^\top\mu=0\);
  • inconsistent constraints or a numerically unsolvable system return an error.

This entry performs a single KKT solve and records 1 objective evaluation.

Software interface

  • QuadraticProgram, minimize, equality_constrained: see chapter 18.
  • QuadraticSolution fields and KKT diagnostics: see chapter 20.
  • Sign conventions for constraint multipliers: see chapter 1.
  • API reference (docs.rs): quadratic.

References

  • 马昌凤, 最优化方法及其 Matlab 程序设计 (in Chinese), 2010, chapter 11.
  • J. Nocedal, S. J. Wright, Numerical Optimization, 2nd ed., 2006, Chapter 16.
  • P. E. Gill, W. Murray, M. H. Wright, Practical Optimization, Academic Press, 1981.