When solving optimization problems in cvxpy, is there a good way to verify that the constraints are valid by replacing the actual values for the optimization variables?
I have a difficult optimization task (more than 100 restrictions), but I know what an optimal solution should be. However, cvxpy crashes with an error message. ValueError: Rank(A) < p or Rank([G; A]) < n
I think this is because I have a typo in one of the limitations, which makes them inconsistent. Is there a good way to replace the actual values for the variables to see which constraints are violated (since they probably have typos)?
My actual problem is complex, so I made a simple example:
from cvxpy import *
x = variable(name='x')
y = variable(name='y')
c1 = greater_equals(x, 1.)
c2 = greater_equals(y, 1.)
c3 = less_equals(x + y, -4.)
p = program(maximize(2. * x + y), [c1, c2, c3])
p.solve()
-4 c3 +4.
: Certificate of primal infeasibility found.
p.show(), :
maximize 2.0*x + y
subject to
x >= 1.0
y >= 1.0
x + y <= -4.0
, (x == 3., y == 1.), , 3- ? x.value ..,