以下代码在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()