-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't find a solution that's not full-dimensional #3
Comments
Yes, compute_polytope_vertices won't work well with tight constraints such as the equality constraint you have formulated this way. If we relax the equality constraint a bit it will find a solution: import pypoman
import numpy as np
# Original problem
A_1 = np.array([[-1, -1, -1], [1, 1, 1], [-1, 0, 0], [1, 0, 0], [0, -1, 0],
[0, 1, 0], [0, 0, -1], [0, 0, 1], [1, 0, 0]])
b_1 = np.array([-1, 1, -0.0001, 0.4999, -0.0001, 0.4999, -0.0001, 0.4999,
0.4999])
print("{} vertices".format(len(pypoman.compute_polytope_vertices(A_1, b_1))))
# Add new variable
A_2 = np.hstack([[[-1], [1], [0], [0], [0], [0], [0], [0], [1]], A_1])
b_2 = b_1
# Add (relaxed) constraint that new variable is == 0
epsilon = 1e-3
A_2 = np.vstack([A_2, [[-1, 0, 0, 0], [1, 0, 0, 0]]])
b_2 = np.hstack([b_2, epsilon, epsilon])
print("{} vertices".format(len(pypoman.compute_polytope_vertices(A_2, b_2)))) For me conversion of the second problem works down to For equality constraints, you could switch to |
Closing this issue now, feel free to re-open for further discussion. |
In the attached example, pypoman incorrectly says that the first LP is feasible but the second is not. However, they should both be feasible. In going from the first LP to the second, all I have done is added one new variable (first column of A_2) and two new constraints (last two rows of A_2 and last two entries of b_2) enforcing that the new variable be zero. Therefore, we can take a solution from the first LP and append a zero to the beginning to get a solution to the second LP. Yet when I enumerate the vertices, the second one comes up empty. The problem has something to do with decimal precision; if you round each decimal entry of b_2 to one less decimal place, the problem disappears. FYI, I am using Python 3.8.5.
pypoman_bug.zip
The text was updated successfully, but these errors were encountered: