user236215 - 2 months ago 10

R Question

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

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
c minimize -d^T x + 1/2 * x^T D x
c where A1^T x = b1
c A2^T x >= b2
c
c the matrix D is assumed to be positive definite. Especially,
c w.l.o.g. D is assumed to be symmetric.
```

Source (Stackoverflow)

Comments