问题描述
我发现CVXPY随机失败,并出现以下错误:
ArpackError: ARPACK error 3: No shifts could be applied during a cycle of the Implicitly restarted
Arnoldi iteration. One possibility is to increase the size of NCV relative to NEV.
下面的代码是一个最小的示例,在该示例中它仅尝试进行均值方差优化,而没有约束,恒等相关矩阵和正态均值向量。每千次运行大约一次失败。我要求使用哪个求解器似乎并不重要,这使我认为它无法解决问题?
import cvxpy as cp
import numpy as np
n = 199
np.random.seed(100)
mu = np.random.normal(size = n)
C = np.eye(n)
for repeat in range(1000):
x = cp.Variable(n)
mean = x.T @ mu
variance = cp.quad_form(x,C)
objective = cp.Maximize(mean - variance)
constraints = []
prob = cp.Problem(objective,constraints)
result = prob.solve()
print(repeat,end = " ")
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)