Polyhedron in constraint representation (HPolyhedron)
LazySets.HPolyhedronModule.HPolyhedron — Type
HPolyhedron{N, VN<:AbstractVector{N}} <: AbstractPolyhedron{N}Type that represents a convex polyhedron in constraint representation, that is, a finite intersection of half-spaces,
\[P = ⋂_{i = 1}^m H_i,\]
where each $H_i = \{x ∈ ℝ^n : a_i^T x ≤ b_i \}$ is a half-space, $a_i ∈ ℝ^n$ is the normal vector of the $i$-th half-space and $b_i$ is the displacement. The set $P$ may or may not be bounded (see also HPolytope, which assumes boundedness).
Fields
constraints– vector of linear constraints
Conversion
convert(::Type{HPolyhedron}, ::LazySet)
convert(::Type{HPolyhedron}, ::Polyhedra.HRep)Operations
Base.rand — Method
rand(T::Type{<:LazySet}; [N]::Type{<:Real}=Float64, [dim]::Int=2,
[rng]::AbstractRNG=GLOBAL_RNG, [seed]::Union{Int, Nothing}=nothing
)Create a random set of the given set type.
Input
T– set typeN– (optional, default:Float64) numeric typedim– (optional, default: 2) dimensionrng– (optional, default:GLOBAL_RNG) random number generatorseed– (optional, default:nothing) seed for reseeding
Output
A random set of the given set type.
The following methods are shared between HPolytope and HPolyhedron.
LazySets.API.dim — Method
dim(X::LazySet)Compute the ambient dimension of a set.
Input
X– set
Output
The ambient dimension of the set.
LazySets.API.dim — Method
Extended help
dim(P::HPoly)Output
If P has no constraints, the result is $-1$.
LinearAlgebra.normalize — Method
normalize(P::HPoly{N}, p::Real=N(2)) where {N}Normalize a polyhedron in constraint representation.
Input
P– polyhedron in constraint representationp– (optional, default:2) norm
Output
A new polyhedron in constraint representation whose normal directions $a_i$ are normalized, i.e., such that $‖a_i‖_p = 1$ holds.
LazySets.remove_redundant_constraints — Method
remove_redundant_constraints(P::HPoly{N}; [backend]=nothing) where {N}Remove the redundant constraints in a polyhedron in constraint representation.
Input
P– polyhedronbackend– (optional, default:nothing) the backend used to solve the linear program
Output
A polyhedron equivalent to P but with no redundant constraints, or an empty set if P is detected to be empty, which may happen if the constraints are infeasible.
Notes
If backend is nothing, it defaults to default_lp_solver(N).
Algorithm
See remove_redundant_constraints!(::AbstractVector{<:HalfSpace}) for details.
LazySets.remove_redundant_constraints! — Method
remove_redundant_constraints!(P::HPoly{N}; [backend]=nothing) where {N}Remove the redundant constraints of a polyhedron in constraint representation; the polyhedron is updated in-place.
Input
P– polyhedronbackend– (optional, default:nothing) the backend used to solve the linear program
Output
true if the method was successful and the polyhedron P is modified by removing its redundant constraints, and false if P is detected to be empty, which may happen if the constraints are infeasible.
Notes
If backend is nothing, it defaults to default_lp_solver(N).
Algorithm
See remove_redundant_constraints!(::AbstractVector{<:HalfSpace}) for details.
LazySets.tohrep — Method
tohrep(P::HPoly)Return a constraint representation of the given polyhedron in constraint representation (no-op).
Input
P– polyhedron in constraint representation
Output
The same polyhedron instance.
LazySets.tovrep — Method
tovrep(P::HPoly; [backend]=default_polyhedra_backend(P))Transform a polytope in constraint representation to a polytope in vertex representation.
Input
P– polytope in constraint representationbackend– (optional, default:default_polyhedra_backend(P)) the backend for polyhedral computations
Output
A VPolytope which is a vertex representation of the given polytope in constraint representation.
Notes
The conversion may not preserve the numeric type (e.g., with N == Float32) depending on the backend. For further information on the supported backends see Polyhedra's documentation.
LazySets.addconstraint! — Method
addconstraint!(P::HPoly, constraint::HalfSpace)Add a linear constraint to a polyhedron in constraint representation.
Input
P– polyhedron in constraint representationconstraint– linear constraint to add
Notes
It is left to the user to guarantee that the dimension of all linear constraints is the same.
LazySets.API.ρ — Method
ρ(d::AbstractVector, X::LazySet)Evaluate the support function of a set in a given direction.
Input
d– directionX– set
Output
The evaluation of the support function of X in direction d.
Notes
The convenience alias support_function is also available.
We have the following identity based on the support vector $σ$:
\[ ρ(d, X) = d ⋅ σ(d, X)\]
LazySets.API.ρ — Method
Extended help
ρ(d::AbstractVector{M}, P::HPoly{N};
solver=default_lp_solver(M, N)) where {M, N}Input
solver– (optional, default:default_lp_solver(M, N)) the backend used to solve the linear program
Output
If P is unbounded in the given direction, there are two cases:
- If
Pis anHPolytope, we throw an error. - If
Pis anHPolyedron, the result isInf.
LazySets.API.σ — Method
σ(d::AbstractVector, X::LazySet)Compute a support vector of a set in a given direction.
Input
d– directionX– set
Output
A support vector of X in direction d.
Notes
The convenience alias support_vector is also available.
LazySets.API.σ — Method
Extended help
σ(d::AbstractVector{M}, P::HPoly{N};
solver=default_lp_solver(M, N) where {M, N}Input
solver– (optional, default:default_lp_solver(M, N)) the backend used to solve the linear program
Output
If P is unbounded in the given direction, there are two cases:
- If
Pis anHPolytope, we throw an error. - If
Pis anHPolyedron, the result contains±Infentries.
LazySets.API.translate — Method
translate(X::LazySet, v::AbstractVector)Compute the translation of a set with a vector.
Input
X– setv– vector
Output
A set representing $X + \{v\}$.
LazySets.API.translate — Method
Extended help
translate(P::HPoly, v::AbstractVector; [share]::Bool=false)Input
share– (optional, default:false) flag for sharing unmodified parts of the original set representation
Notes
The normal vectors of the constraints (vector a in a⋅x ≤ b) are shared with the original constraints if share == true.
LazySets.API.convex_hull — Method
convex_hull(P1::HPoly, P2::HPoly;
[backend]=default_polyhedra_backend(P1))Compute the convex hull of the set union of two polyhedra in constraint representation.
Input
P1– polyhedronP2– polyhedronbackend– (optional, default:default_polyhedra_backend(P1)) the backend for polyhedral computations
Output
The HPolyhedron (resp. HPolytope) obtained by the concrete convex hull of P1 and P2.
Notes
For performance reasons, it is suggested to use the CDDLib.Library() backend for the convex_hull.
For further information on the supported backends see Polyhedra's documentation.
Undocumented implementations:
ishyperplanar(::HPolyhedron)
Inherited from LazySet:
areachebyshev_center_radiuscomplementconcretizeconstraintsconvex_hullcopy(::Type{LazySet})diametereltypeeltypeisboundedtypeisoperationispolytopicnormpolyhedronradiusrationalizerectifyreflectsingleton_listtosimplehreptriangulatetriangulate_facesverticesvolumeaffine_mapexponential_mapis_interior_pointlinear_mapsamplescalecartesian_productdifferenceexact_sumisapprox==isequivalent⊂minkowski_difference
Inherited from ConvexSet:
Inherited from AbstractPolyhedron: