Contents Previous Next Subchapters Current Chapters-> interp interp1 lagrange polyfit smospl cubespl cubeval interp2 mlmode_interp2 snewton brent linlsq linlsqb nlsq dnlsq nlsqbox dnlsqb conjdir neldermead conjgrad minline lemke Qpos Qbox Qpro sqp relative fordiff cendiff autodiff testder testgrad testhess Parent Chapters-> Omatrix6 fit Qpro Search Tools-> contents reference index search

Quadratic Programming with Equality and Inequality Constraints
 Syntax `Qpro(`level`, `G`, `g`, `A`, `a`, `neq`, `xlow`, `xup`, `xout`, `yAout`, `yLout`, `yUout`)` See Also sqp , Qbox

Description
Determines the value of the x that solves the problem ```      minimize  (1/2) x' G x + g x  with respect to x      such that A.row(i) x + a(i) = 0 for i = 1, ..., neq                A.row(i) x + a(i) < 0 for i = neq + 1, ..., rowdim(A)                xlow < x < xup ```The Lagrangian for this problem is ```      L(x, yA, yL, yU) = (1/2) x' G x  + g x           + yA' (A x + a) + yL' (xlow - x) + yU' (xup - x) ```The return value of `Qpro` is true if it succeeds in solving the problem and false otherwise. ``` ```The real or double-precision symmetric positive definite matrix G contains the quadratic term in the objective function. The row vector g specifies the linear term in the objective function. It has the same type and number of columns as G. The matrix A specifies the linear term in the constraints. It has the same type and column dimension as G. The column vector a specifies the constant term in the constraints. It has the same type and row dimension as A. ``` ```The input values of the parameters xout, yAout, yLout, and yUout do not matter. If the return value of `Qpro` is true, the output value of these parameters satisfy the Kuhn-Tucker condition in Equation (9.1.16) of Practical Methods of Optimization, namely: ``` ```1. The partial of `L` with respect to `x` is zero at the point `(xout, yAout, yLout, yUout)` ``` ```2. The constraints are satisfied at the point `xout`. ``` ```3. All of the elements of `yLout` and `yUout` are greater than zero. In addition, the elements of `yAout` with index greater than `neq` are greater than zero. ``` ```4. The following equations hold ```       0 = yAout' (- A x - a)      0 = yLout' (x - xlow)      0 = yUout' (xup - x) ```Note that because all the terms in these products are non-negative, this implies each term is zero. The output value of xout, yLout and yUout are a column vectors with the same type and dimensions as xlow. The output value of yAout is a column vector with the same type and row dimension as A. ``` ```The parameter level is an integer scalar specifying the level of tracing inside of the `Qpro` function. If `level > 1`, the text "Beginning Qpro" and the value of G, g, A, a, xlow, and xup, are printed before attempting to solve this problem. If `Qpro` cannot solve the problem, the text "Qpro returns false" is printed before it returns. If `Qpro` does solve the problem, the output values of xout, yAout, yLout, and yUout are printed. In addition the partial of `L` with respect to `x`, and `A xout + a` are printed together with the text "Qpro returns true". ``` ```If `level > 2`, a tracing level of `level - 1` is used in the call to Qbox that is used by `Qpro`.

Example
The program below solves the problem ```      minimize   x(1)^2 + x(2)^2 + 2 x(1) + x(2)      subject to - x(1) - x(2) < 0 `````` clear level = 1 G     = {[2., 0], [0, 2.]} g     = [2., 1.] A     = [-1., -1.] a     = 0. neq   = 0 xlow  = {-10., -10.} xup   = {+10., +10.} xout  = novalue yAout = novalue yLout = novalue yUout = novalue ok = Qpro(level, G, g, A, a, neq, xlow, xup, xout, yAout, yLout, yUout) print "ok =", ok ```