Solve.QP requires that D 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 not positive definite. Why is this necessary? If I solve it myself using the Lagrange functions, I can get a solution. Then why does R impose this requirement?

+3
source share
2 answers

The Goldfarb-Idnani algorithm begins by computing an unlimited solution. Thus, it is required that the matrix D in the objective function be positive definite.

Excerpt from Fortran solve.QP.f source file:

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.
+4
source

auglag alabama lagrange .

+1

Source: https://habr.com/ru/post/1759952/