QPsolve {scdensity} | R Documentation |
A wrapper to call solve.QP.
Description
This function takes arguments slightly differently from solve.QP, to make it more convenient for internal use. It also implements measures to robustify calls to solve.QP:
A rounding hack to prevent a bug in solve.QP that occasionally produces all-NaN solutions without returning a warning or error. Rounding has been found to eliminate almost all such bugs.
A call to lpSolve's lp() to check feasibility before running solve.QP
solve.QP is called within tryCatch to eliminate unwanted crashes.
The output of this function is a list with elements
-
flag
is 0 for successful completion, 1 for failure at the LP check stage, and 2 for failure at the QP stage (usually the "NaN solution" bug). -
QP
is the list returned bysolve.QP
. If the QP was not run due to infeasibility, this element is NULL.
Usage
QPsolve(D, d, A, b, Aeq, beq)
Arguments
D |
The matrix of the quadratic objective. |
d |
The vector in the linear term of the quadratic objective. |
A |
The matrix of inequality constraints. |
b |
The vector of RHS of the inequalities. |
Aeq |
The matrix of equality constraints. |
beq |
The vector of RHS of the equalities. |
Details
solve.QP defines its quadratic program as minimizing 1/2 * x'Dx - x'd, subject to constraints A'x >= b. Equality constraints have to be in the first rows of A'.
This function minimizes x'Dx - x'd, subject to inequality constraints Ax >= b and Equality constraints Aeq*x = beq.
Value
A list with elements described above.