user236215 user236215 -4 years ago 184
R Question

solve.QP require D to be symmetric positive definite in R

When I run solve.QP on my problem, I get the following error from R:

Error in solve.QP(sigma, rep(0, 5), t(Amat), bvec, meq = 2) :
matrix D in quadratic function is not positive definite!

My sigma matrix is symmetric but is not positive definite. Why is this needed? If I solve it myself using Lagrangian functions, I am able to get the solution. Then why is R imposing this requirement?

Answer Source

The Goldfarb-Idnani algorithm starts off by calculating the unconstrained solution. Thus, it requires that the matrix D in the objective function is positive definite.

Excerpt from Fortran source file solve.QP.f:

c  this routine uses the Goldfarb/Idnani algorithm to solve the
c  following minimization problem:
c        minimize  -d^T x + 1/2 *  x^T D x
c        where   A1^T x  = b1
c                A2^T x >= b2
c  the matrix D is assumed to be positive definite.  Especially,
c  w.l.o.g. D is assumed to be symmetric.
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download