### 7.2 Quadratic programming ¶

This function is similar to `qp` of core Octave.

Function File: quadprog `(H, f)` ¶
Function File: quadprog `(H, f, A, b)` ¶
Function File: quadprog `(H, f, A, b, Aeq, beq)` ¶
Function File: quadprog `(H, f, A, b, Aeq, beq, lb, ub)` ¶
Function File: quadprog `(H, f, A, b, Aeq, beq, lb, ub, x0)` ¶
Function File: quadprog `(H, f, A, b, Aeq, beq, lb, ub, x0, options)` ¶
Function File: `[x, fval, exitflag, output, lambda] =` quadprog `(…)` ¶

  Solve the quadratic program

      min 0.5 x'*H*x + x'*f
       x

  subject to

      A*x <= b,
      Aeq*x = beq,
      lb <= x <= ub.

  The initial guess x0 and the constraint arguments (A and b, Aeq and beq, lb and ub) can be set to the empty matrix (`[]`) if not given. If the initial guess x0 is feasible the algorithm is faster.

  options can be set with `optimset`, currently the only option is `MaxIter`, the maximum number of iterations (default: 200).

  Returned values:

  x

    Position of minimum.

  fval

    Value at the minimum.

  exitflag

    Status of solution:

    `0`

      Maximum number of iterations reached.

    `-2`

      The problem is infeasible.

    `-3`

      The problem is not convex and unbounded

    `1`

      Global solution found.

    `4`

      Local solution found.

  output

    Structure with additional information, currently the only field is `iterations`, the number of used iterations.

  lambda

    Structure containing Lagrange multipliers corresponding to the constraints. For equality constraints, the sign of the multipliers is chosen to satisfy the equation

        0.5 H * x + f + A' * lambda_inequ + Aeq' * lambda_equ = 0 .

    If lower and upper bounds are equal, or so close to each other that they are considered equal by the algorithm, only one of these bounds is considered active when computing the solution, and a positive lambda will be placed only at this bound.

  This function calls Octave’s `__qp__` back-end algorithm internally.