gpt4 book ai didi

r - solv.QP 要求 D 在 R 中是对称正定的

转载 作者:行者123 更新时间:2023-12-02 09:08:33 25 4
gpt4 key购买 nike

当我对我的问题运行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!

我的西格玛矩阵是对称的,但不是正定的。为什么需要这个?如果我自己使用拉格朗日函数解决它,我就能得到解决方案。那么为什么 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.

关于r - solv.QP 要求 D 在 R 中是对称正定的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3496882/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com