vertexenum: Vertex enumeration

[ geometry, gpl, library, math ] [ Propose Tags ]

Vertex enumeration of convex polytopes given by linear inequalities.

Modules

[Index] [Quick Jump]

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0.0, 0.1.1.0, 1.0.0.0 CHANGELOG.md base (>=4.7 && <5), containers (>=0.6.5.1 && <0.7), extra (>=1.7 && <1.8), monad-logger (>=0.3.40 && <0.4), simplex-method (>=0.2.0.0 && <0.3), vector-space (>=0.15 && <0.17) [details] GPL-3.0-only 2023-2024 Stéphane Laurent Stéphane Laurent laurent_step@outlook.fr Math, Geometry https://github.com/stla/vertexenum#readme head: git clone https://github.com/stla/vertexenum by stla at 2024-05-08T07:47:09Z NixOS:1.0.0.0 1 direct, 0 indirect [details] 55 total (23 in the last 30 days) (no votes yet) [estimated by Bayesian average] λ λ λ Docs available Last success reported on 2024-05-08

[back to package description]

vertexenum

Get the vertices of an intersection of halfspaces.

Consider the following system of linear inequalities:

$\left\{\begin{matrix} -5 & \leqslant & x & \leqslant & 4 \\ -5 & \leqslant & y & \leqslant & 3-x \\ -10 & \leqslant & z & \leqslant & 6-2x-y \end{matrix}.\right.$

Each inequality defines a halfspace. The intersection of the six halfspaces is a convex polytope. The vertexenum function can calculate the vertices of this polytope:

import Data.VectorSpace     (
, VectorSpace( (*^) )
)
import Geometry.VertexEnum

inequalities :: [Constraint Rational]
inequalities =
[ x .>= (-5)         -- shortcut for x .>=. cst (-5)
, x .<=  4
, y .>= (-5)
, y .<=. cst 3 ^-^ x -- we need cst here
, z .>= (-10)
, z .<=. cst 6 ^-^ 2*^x ^-^ y ]
where
x = newVar 1
y = newVar 2
z = newVar 3

vertexenum constraints Nothing

The type of the second argument of vertexenum is Maybe [Double]. If this argument is Just point, then point must be the coordinates of a point interior to the polytope. If this argument is Nothing, an interior point is automatically calculated. You can get it with the interiorPoint function. It is easy to mentally get an interior point for the above example, but in general this is not an easy problem.