Containment/Redundancy
Containment
Base.in
— Function.in(p::VRepElement, h::HRepElement)
Returns whether p
is in h
. If h
is an hyperplane, it returns whether $\langle a, x \rangle \approx \beta$. If h
is an halfspace, it returns whether $\langle a, x \rangle \le \beta$.
in(p::VRepElement, h::HRep)
Returns whether p
is in h
, e.g. in all the hyperplanes and halfspaces supporting h
.
Base.issubset
— Function.issubset(p::Rep, h::HRepElement)
Returns whether p
is a subset of h
, i.e. whether h
supports the polyhedron p
.
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
.
Linearity
Polyhedra.detecthlinearity!
— Function.detecthlinearity!(p::VRep)
Detects all the hyperplanes contained in the H-representation and remove all redundant hyperplanes.
Examples
The representation
h = HalfSpace([1, 1], 1]) ∩ HalfSpace([-1, -1], -1)
contains the hyperplane HyperPlane([1, 1], 1)
.
Polyhedra.detectvlinearity!
— Function.detectvlinearity!(p::VRep)
Detects all the lines contained in the V-representation and remove all redundant lines.
Examples
The representation
v = conichull([1, 1], [-1, -1])
contains the line Line([1, 1])
.
Polyhedra.dim
— Function.dim(h::HRep, current=false)
Returns the dimension of the affine hull of the polyhedron. That is the number of non-redundant hyperplanes that define it. If current
is true
then it simply returns the dimension according the current number of hyperplanes, assuming that the H-linearity has already been detected. Otherwise, it first calls detecthlinearity!
.
Duplicates
Polyhedra.removeduplicates
— Function.removeduplicates(rep::Representation)
Removes the duplicates in the Representation.
- In an H-representation, it removes the redundant hyperplanes and it remove an halfspace when it is equal to another halfspace in the affine hull. For instance,
HalfSpace([1, 1], 1)
is equal toHalfSpace([1, 0], 0)
in the affine hull generated byHyperPlane([0, 1], 1])
. - In a V-representation, it removes the redundant lines and it remove a point (resp. ray) when it is equal to another point (resp. ray) in the line hull. For instance, in the line hull generated by
Line([0, 1])
,[1, 1]
is equal to[1, 0]
andRay([2, 2])
is equal toRay([1, 0])
.
Redundancy
Polyhedra.isredundant
— Function.isredundant(p::Rep, idx::Index; strongly=false)
Return a Bool
indicating whether the element with index idx
can be removed without changing the polyhedron represented by p
. If strongly
is true
,
- if
idx
is an H-representation elementh
, it returnstrue
only if no V-representation element ofp
is in the hyperplane ofh
. - if
idx
is a V-representation elementv
, it returnstrue
only ifv
is in the relative interior ofp
.
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.
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.