Utilities
Redundancy
Polyhedra.removevredundancy!
— Function.removevredundancy!(P::VRep)
Removes the elements of the V-representation of P
that can be removed without changing the polyhedron represented by P
. That is, it only keeps the extreme points and rays. This operation is often called "convex hull" as the remaining points are the extreme points of the convex hull of the initial set of points.
Polyhedra.removehredundancy!
— Function.removehredundancy!(P::HRep)
Removes the elements of the H-representation of P
that can be removed without changing the polyhedron represented by P
. That is, it only keeps the halfspaces corresponding to facets of the polyhedron.
Operations
Base.intersect
— Function.intersect(P1::HRep, P2::HRep)
Takes the intersection of P1
and P2
$\{\, x : x \in P_1, x \in P_2 \,\}$. It is very efficient between two H-representations or between two polyhedron for which the H-representation has already been computed. However, if P1
(resp. P2
) is a polyhedron for which the H-representation has not been computed yet, it will trigger a representation conversion which is costly. See the Polyhedral Computation FAQ for a discussion on this operation.
The type of the result will be chosen closer to the type of P1
. For instance, if P1
is a polyhedron (resp. H-representation) and P2
is a H-representation (resp. polyhedron), intersect(P1, P2)
will be a polyhedron (resp. H-representation). If P1
and P2
are both polyhedra (resp. H-representation), the resulting polyhedron type (resp. H-representation type) will be computed according to the type of P1
. The coefficient type however, will be promoted as required taking both the coefficient type of P1
and P2
into account.
Polyhedra.convexhull
— Function.convexhull(P1::VRep, P2::VRep)
Takes the convex hull of P1
and P2
$\{\, \lambda x + (1-\lambda) y : x \in P_1, y \in P_2 \,\}$. It is very efficient between two V-representations or between two polyhedron for which the V-representation has already been computed. However, if P1
(resp. P2
) is a polyhedron for which the V-representation has not been computed yet, it will trigger a representation conversion which is costly.
The type of the result will be chosen closer to the type of P1
. For instance, if P1
is a polyhedron (resp. V-representation) and P2
is a V-representation (resp. polyhedron), convexhull(P1, P2)
will be a polyhedron (resp. V-representation). If P1
and P2
are both polyhedra (resp. V-representation), the resulting polyhedron type (resp. V-representation type) will be computed according to the type of P1
. The coefficient type however, will be promoted as required taking both the coefficient type of P1
and P2
into account.
Containment
Polyhedra.ininterior
— Function.ininterior(p::VRepElement, h::HRepElement)
Returns whether p
is in the interior of h
. If h
is an hyperplane, it always returns false
. If h
is an halfspace $\langle a, x \rangle \leq \beta$, it returns whether p
is in the open halfspace $\langle a, x \rangle < \beta$
ininterior(p::VRepElement, h::HRep)
Returns whether p
is in the interior of h
, e.g. in the interior of all the hyperplanes and halfspaces supporting h
.
Polyhedra.inrelativeinterior
— Function.inrelativeinterior(p::VRepElement, h::HRepElement)
Returns whether p
is in the relative interior of h
. If h
is an hyperplane, it is equivalent to p in h
since the relative interior of an hyperplane is itself. If h
is an halfspace, it is equivalent to ininterior(p, h)
.
inrelativeinterior(p::VRepElement, h::HRep)
Returns whether p
is in the relative interior of h
, e.g. in the relative interior of all the hyperplanes and halfspaces supporting h
.
Volume
Polyhedra.volume
— Function.volume(p::Polyhedron{N, T}) where {N, T}
Returns the N
-dimensional hyper-volume of the polyhedron p
. Returns Inf
or -one(T)
if it is infinite depending on whether the type T
has an infinite value.
Polyhedra.surface
— Function.surface(p::Polyhedron{N, T}) where {N, T}
Returns the N-1
-dimensional hyper-volume of the surface of the polyhedron p
. Returns Inf
or -one(T)
if it is infinite depending on whether the type T
has an infinite value.
Chebyshev center
Polyhedra.chebyshevcenter
— Function.chebyshevcenter(p::Rep[, solver])
If p
is a H-representation or is a polyhedron for which the H-representation has already been computed, calls hchebyshevcenter
, otherwise, call vchebyshevcenter
.
Polyhedra.hchebyshevcenter
— Function.hchebyshevcenter(p::HRep[, solver])
Return a tuple with the center and radius of the largest euclidean ball contained in the polyhedron p
. Throws an error if the polyhedron is empty or if the radius is infinite.
Polyhedra.vchebyshevcenter
— Function.vchebyshevcenter(p::VRep[, solver])
Return a tuple with the center and radius of the smallest euclidean ball containing the polyhedron p
. Throws an error if the polyhedron is empty or if the radius is infinite (i.e. p
is not a polytope, it contains rays).