当我在我的问题上运行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矩阵是对称的,但不是正定的。为什么需要这个?如果我自己使用Lagrangian函数自己解决,我就可以获得解决方案。那为什么r强加了这一要求?

有帮助吗?

解决方案

Goldfarb-Idnani算法通过计算不受约束的溶液开始。因此,它要求目标函数中的矩阵D是正定的。

摘录摘自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.

其他提示

功能 auglag 在包装中 alabama 为任何优化问题提供解决方案上的Lagrange乘数。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top