QProg

Purpose

Solves the quadratic programming problem.

Format

{ x, u1, u2, u3, u4, u5 } = QProg(start, q, r, a, b, c, d, bnds)
Parameters:
  • start (Kx1 vector) – start values.
  • q (KxK matrix) – symmetric model matrix.
  • r (Kx1 vector) – model constant vector.
  • a (MxK matrix) – equality constraint coefficient matrix, or scalar 0, no equality constraints.
  • b (Mx1 vector) – equality constraint constant vector, or scalar 0, will be expanded to Mx1 vector of zeros.
  • c (NxK matrix) – inequality constraint coefficient matrix, or scalar 0, no inequality constraints.
  • d (Nx1 vector) – inequality constraint constant vector, or scalar 0, will be expanded to Nx1 vector of zeros.
  • bnds (Kx2 matrix) – bounds on x, the first column contains the lower bounds on x, and the second column the upper bounds. If scalar 0, the bounds for all elements will default to ±1e200.
Returns:
  • x (Kx1 vector) – coefficients at the minimum of the function.
  • u1 (Mx1 vector) – Lagrangian coefficients of equality constraints.
  • u2 (Nx1 vector) – Lagrangian coefficients of inequality constraints.
  • u3 (Kx1 vector) – Lagrangian coefficients of lower bounds.
  • u4 (Kx1 vector) – Lagrangian coefficients of upper bounds.
  • ret (scalar) –

    return code.

    0 termination
    1 iterations exceeded
    2 accuracy is insufficient to maintain decreasing function values
    3 matrices not conformable
    < 0 constraints inconsistent

Global Input

_qprog_maxit:(scalar), maximum number of iterations. Default = 1000.

Remarks

QProg() solves the standard quadratic programming problem:

\[min\; \frac{1}{2} x'Qx - x'R\]

subject to constraints,

\[\begin{split}Ax = B\\ Cx \geq D\end{split}\]

and bounds,

\[x_{low} ≤ x ≤ x_{up}\]

Source

qprog.src