CVXR:无法识别凸函数

时间:2019-07-01 04:02:54

标签: r cvx

我正在尝试使用CVXR在线性约束下进行二次优化。 我在R中有以下矩阵:

HL <- matrix(c(
        s[2]*sqp[2]*sqq[2],0,0,0,0,0,0,0,0,0,0,0,
        0,s[3]*sqp[3]*sqq[3],0,0,0,0,0,0,0,0,0,0,
        0,0,s[4]*sqp[4]*sqq[4],0,0,0,0,0,0,0,0,0,
        0,0,0,s[1]*sqp[1]*sqq[1],0,0,0,0,0,0,0,0,
        0,0,0,0,s[3]*sqp[3]*sqq[3],0,0,0,0,0,0,0,
        0,0,0,0,0,s[4]*sqp[4]*sqq[4],0,0,0,0,0,0,
        0,0,0,0,0,0,s[1]*sqp[1]*sqq[1],0,0,0,0,0,
        0,0,0,0,0,0,0,s[2]*sqp[2]*sqq[2],0,0,0,0,
        0,0,0,0,0,0,0,0,s[4]*sqp[4]*sqq[4],0,0,0,
        0,0,0,0,0,0,0,0,0,s[1]*sqp[1]*sqq[1],0,0,
        0,0,0,0,0,0,0,0,0,0,s[2]*sqp[2]*sqq[2],0,
        0,0,0,0,0,0,0,0,0,0,0,s[3]*sqp[3]*sqq[3]
        ), nrow = num_vars, ncol = num_vars);

然后,我尝试构造一个符合DCP规则集的形式: 首先定义x = Variable(num_vars),然后编写 fnc <- t(x) %*% HL %*% HL %*% x,甚至是y <- HL%*%x之类的东西, 和fnc <- t(y)%*%y。根据{{​​3}}(请参见二次形式部分),应将其识别为凸形。但是,当我加载 将我的源代码放入R,我得到

  

形成非凸表达式(仿射)*(仿射)

如何解决此问题?我需要CVXR才能将我的功能识别为“遵循DCP规则”。

0 个答案:

没有答案