Reputation: 11
I recently discovered the cvxpy package and try to use it on a pretty basic minimization problem. But while initializing my convex problem I always get a DCP Error which i can't explain.
x = Variable(m)
gamma = Parameter(value=1.0)
cost = sum_squares(np.transpose(A_shaped)*x - b_real) + gamma*norm(x,1)
obj = Minimize(cost)
constr = [np.transpose(A_shaped)* x <= b_real + abs(b_real * eps),
np.transpose(A_shaped)* x >= b_real - abs(b_real * eps)]
prob = Problem(obj, constr)
print(prob.is_dcp())
All the parameters like m, A_shaped, b_real and eps are defined before.
My Problem: Whenever I use the Parameter gamma in the declaration of cost and I want to solve it cvxpy tells me the problem does not follow DCP rules and it's because of the subexpression param123 * norm124. When I replace gamma by 1.0 or remove it I don't get this error and prob.is_dcp() returns True, which I can't explain, because I initialize gamma with the value 1.0.
If you need further information feel free to ask and thanks a lot in advance!
Upvotes: 1
Views: 502
Reputation: 11
Alright I found the solution: I only tested to set the parameter's argument nonpos to False but that didn't help. What I didn't know, there's also the argument nonneg, which I then set to True and now the DCP analysis returns True as well.
Upvotes: 0