Polytope in constraint representation (HPolytope)
Convex polytopes are bounded polyhedra. The type HPolytope
represents polytopes. While identical to HPolyhedron
in implementation, HPolytope
instances are assumed to be bounded.
LazySets.HPolytope
— Type.HPolytope{N<:Real, VN<:AbstractVector{N}} <: AbstractPolytope{N}
Type that represents a convex polytope in H-representation.
Fields
constraints
– vector of linear constraintscheck_boundedness
– (optional, default:false
) flag for checking if the constraints make the polytope bounded; (boundedness is a running assumption of this type)
Note
Recall that a polytope is a bounded polyhedron. Boundedness is a running assumption in this type.
Some functionality is shared with HPolyhedron
. Below follows the additional functionality specific to HPolytope
.
Base.rand
— Method.rand(::Type{HPolytope}; [N]::Type{<:Real}=Float64, [dim]::Int=2,
[rng]::AbstractRNG=GLOBAL_RNG, [seed]::Union{Int, Nothing}=nothing)
Create a random polytope in constraint representation.
Input
HPolytope
– type for dispatchN
– (optional, default:Float64
) numeric typedim
– (optional, default: 2) dimensionrng
– (optional, default:GLOBAL_RNG
) random number generatorseed
– (optional, default:nothing
) seed for reseedingnum_vertices
– (optional, default:-1
) upper bound on the number of vertices of the polytope (see comment below)
Output
A random polytope in constraint representation.
Algorithm
We create a random polytope in vertex representation and convert it to constraint representation (hence the argument num_vertices
). See rand(::Type{VPolytope})
.
LazySets.vertices_list
— Method.vertices_list(P::HPolytope{N};
[backend]=nothing, [prune]::Bool=true) where {N<:Real}
Return the list of vertices of a polytope in constraint representation.
Input
P
– polytope in constraint representationbackend
– (optional, default:nothing
) the polyhedral computations backendprune
– (optional, default:true
) flag to remove redundant vertices
Output
List of vertices.
Algorithm
If the polytope is two-dimensional, the polytope is converted to a polygon in H-representation and then its vertices_list
function is used. This ensures that, by default, the optimized two-dimensional methods are used.
It is possible to use the Polyhedra
backend in two-dimensions as well by passing, e.g. backend=CDDLib.Library()
.
If the polytope is not two-dimensional, the concrete polyhedra manipulation library Polyhedra
is used. The actual computation is performed by a given backend; for the default backend used in LazySets
see default_polyhedra_backend(N)
. For further information on the supported backends see Polyhedra's documentation.
LazySets.isbounded
— Function.isbounded(P::HPolytope, [use_type_assumption]::Bool=true)
Determine whether a polytope in constraint representation is bounded.
Input
P
– polytope in constraint representationuse_type_assumption
– (optional, default:true
) flag for ignoring the type assumption that polytopes are bounded
Output
true
if use_type_assumption
is activated. Otherwise, true
iff P
is bounded.
Algorithm
If !use_type_assumption
, we convert P
to an HPolyhedron
P2
and then use isbounded(P2)
.
Inherited from AbstractPolytope
: