I want to use warm start to check whether there's performance benefit by setting a cvx.Parameter, while I come accross this:
cvxpy.error.DCPError: Problem does not follow DCP rules.
My code is here:
import time
import numpy as np
import cvxpy as cvx
m = 300
x = cvx.Variable((m, 1))
p_cov = cvx.Parameter((m, m))
prob = cvx.Problem(cvx.Maximize(-cvx.quad_form(x, p_cov)), [x>=0, cvx.sum(x)==1])
for _ in range(10):
df_return = np.random.randn(m, m+1)
cov = np.cov(df_return)
p_cov.value = cov
t1 = time.time()
prob.solve(warm_start=True)
t2 = time.time()
print("Solve time:", round(t2-t1, 2))
I think the point is that p_cov should be a semi-positive matrix, but I just can't solve it. Look forward your help, thank you!