CVXPY DCP违反quad_form上的大量变量/矩阵的规则

时间:2018-11-17 02:28:07

标签: cvxpy

以下代码在n = 10时可以正常工作,但是在n = 150时给出DCP规则违反错误,有什么想法吗?

import numpy as np
from cvxpy import *
np.random.seed(1)
n = 10
mu = np.abs(np.random.randn(n, 1))
Sigma = np.ones((n, n))
w = Variable(n, boolean=True)
gamma = 1
ret = mu.T*w
risk = quad_form(w, Sigma)
prob = Problem(Maximize(ret - gamma*risk))
prob.solve()

0 个答案:

没有答案