Operations Research Asked on August 19, 2021
I have a convex polyhedron given by a set of linear inequalities, for example:
$$
x_1 geq 0,~~ x_2 geq 0, ~~x_3geq 0
\
x_1+x_2leq 1,~~ x_2+x_3leq 1,~~ x_3+x_1leq 1
$$
I want to list all the extreme points of the polyhedron. In this case, these points would be:
$$(0,0,0),~~(1,0,0),~~(0,1,0),~~(0,0,1),~~(1/2,1/2,1/2)$$
In python, there are several linear programming libraries, such as scipy.linprog or cvxpy, that can return one such extreme point using the Simplex method. But I want to list all of them. How can I do this?
The problem of enumerating all vertices of a polytope has been studied, see for example Generating All Vertices of a Polyhedron Is Hard by Khachiyan, Boros, Borys, Elbassioni & Gurvich (available free online at Springer's website) and A Survey and Comparison of Methods for Finding All Vertices of Convex Polyhedral Sets by T. H. Matheiss and D. S. Rubin. That's a pretty old survey though (1980), so newer methods may be available.
A naive brute force approach can be deduced from the definition of vertex/extreme point. Let's call the polytope $P$. Pseudocode can be as follows:
Select a subset of $n$ inequalities (in you example $n = 3$), getting a smaller linear system of inequalities with submatrix $A'$ and vector $b'$.
Solve the linear system $A'x = b'$. There are three cases here:
a. The system has no solution: Then, return to (1) and select another subset (not chosen before).
b. The system has no unique solution: Then, $A'$ is linearly dependent. Return to (1) and select a new subset.
c. The system has a unique solution: If that solution is feasible for $P$, then it's a vertex. Go back to (1).
The algorithm ends when no new subsets can be chosen. Note that different subsets of rows could yield the same vertex.
A second alternative can be treating the polyhedron's vertices and edges as a graph (might work faster than the brute force solution above):
As @batwing mentioned, another alternative is using the Double Description Method by Motzkin et al. to generate all extreme points and extreme rays of a general convex polyhedron represented as a system of linear inequalities $Ax leq b$. An implementation called cdd
can be found at Komei Fukuda's website here, while this GitHub repo contains pycddlib
, a Python wrapper to interact with that library. Finally, at this repo the package pypoman
is developed to interact with the Python wrapper to get the extreme points for $Ax leq b$ starting from $A$ and $b$.
Correct answer by dhasson on August 19, 2021
You obtain all vertices of a polytope using polymake.
You can directly try the online version.
Answered by Graph4Me Consultant on August 19, 2021
It seems to me that cdd libraries can be useful to solve this problem. Description is available at cdd. There is an implementation of this function in R: rcdd. You can use the following instruction to solve this problem:
install.packages("rcdd")
require(rcdd)
scdd(makeH(rbind(-diag(3),c(1,1,0),c(0,1,1),c(1,0,1)),c(rep(0,3),rep(1,3))))
Answered by Sławomir Jarek on August 19, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP