I'm trying to optimize the following 2d linear program using cvxopt:
A = np.array([[1, 0],
[1, 0],
[0, -1],
[0, 1],
], dtype=np.float)
b = np.array([2,
4,
1,
1,
], dtype=np.float)
c = np.array([-1,0])
A = matrix(A)
b = matrix(b)
c = matrix(c)
sol = solvers.lp(c,A,b)
print sol
Essentially, it's a box with constraints on positive x, positive y, and negative y, with a redundant constraint on positive x and no constraint on negative x. The output I get is:
{'status': 'dual infeasible',
'dual slack': None,
'iterations': 5,
'residual as primal infeasibility certificate': None,
'relative gap': None,
'dual objective': None,
'residual as dual infeasibility certificate': 3.039926013128332e-09,
'gap': None, 's': <4x1 matrix, tc='d'>,
'primal infeasibility': None,
'dual infeasibility': None,
'primal objective': -1.0,
'primal slack': 5.32208560659015e-09,
'y': None,
'x': <2x1 matrix, tc='d'>,
'z': None}
The issue is that the LP is unbounded in the negative x direction, so the primal objective should be infinity. I'm not sure why cvxopt is returning -1.0
as the primal objective, at the equally confusing (-1.0, 0)
optimal point.
Is there a way for cvxopt to tell me that the solution is infinity?