当我对我的问题运行Solve.QP时,我从R中收到以下错误:

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


我的sigma矩阵是对称的,但不是正定的。为什么需要这个?如果我自己使用拉格朗日函数解决问题,那么我就能得到解决方案。那么,R为什么要强加这个要求呢?

最佳答案

Goldfarb-Idnani算法首先通过计算
不受约束的解决方案。因此,它要求
目标函数是正定的。

Fortran源文件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.

09-13 10:30