Set Interfaces

Set Interfaces

This section of the manual describes the interfaces for different set types. Every set that fits the description of an interface should also implement it. This helps in several ways:

The interface functions are outlined in the interface documentation. See Common Set Representations for implementations of the interfaces.

Note

The naming convention is such that all interface names (with the exception of the main abstract type LazySet) should be preceded by Abstract.

The following diagram shows the interface hierarchy.

../assets/interfaces.png

LazySet

Every convex set in this library implements this interface.

LazySet{N}

Abstract type for convex sets, i.e., sets characterized by a (possibly infinite) intersection of halfspaces, or equivalently, sets $S$ such that for any two elements $x, y ∈ S$ and $0 ≤ λ ≤ 1$ it holds that $λ x + (1-λ) y ∈ S$.

Notes

LazySet types should be parameterized with a type N, typically N<:Real, for using different numeric types.

Every concrete LazySet must define the following functions:

  • σ(d::AbstractVector{N}, S::LazySet) – the support vector of S in a given direction d

  • dim(S::LazySet)::Int – the ambient dimension of S

julia> subtypes(LazySet)
19-element Array{Union{DataType, UnionAll},1}:
 LazySets.AbstractPointSymmetric
 LazySets.AbstractPolytope
 LazySets.CacheMinkowskiSum
 LazySets.CartesianProduct
 LazySets.CartesianProductArray
 LazySets.ConvexHull
 LazySets.ConvexHullArray
 LazySets.EmptySet
 LazySets.ExponentialMap
 LazySets.ExponentialProjectionMap
 LazySets.HalfSpace
 LazySets.Hyperplane
 LazySets.Intersection
 LazySets.IntersectionArray
 LazySets.Line
 LazySets.LineSegment
 LazySets.LinearMap
 LazySets.MinkowskiSum
 LazySets.MinkowskiSumArray
source

Support function and support vector

Every LazySet type must define a function σ to compute the support vector.

support_vector

Alias for the support vector σ.

source
LazySets.ρFunction.
ρ(d::AbstractVector{N}, S::LazySet{N})::N where {N<:Real}

Evaluate the support function of a set in a given direction.

Input

  • d – direction

  • S – convex set

Output

The support function of the set S for the direction d.

source
support_function

Alias for the support function ρ.

source

Other globally defined set functions

an_element(S::LazySet{N}) where {N<:Real}

Return some element of a convex set.

Input

  • S – convex set

Output

An element of a convex set.

source

Point symmetric set

Point symmetric sets such as balls of different norms are characterized by a center. Note that there is a special interface combination Point symmetric polytope.

AbstractPointSymmetric{N<:Real} <: LazySet{N}

Abstract type for point symmetric sets.

Notes

Every concrete AbstractPointSymmetric must define the following functions:

  • center(::AbstractPointSymmetric{N})::Vector{N} – return the center point

julia> subtypes(AbstractPointSymmetric)
3-element Array{Union{DataType, UnionAll},1}:
 LazySets.Ball2
 LazySets.Ballp
 LazySets.Ellipsoid
source

Polytope

A polytope has finitely many vertices (V-representation) resp. facets (H-representation). Note that there is a special interface combination Point symmetric polytope.

AbstractPolytope{N<:Real} <: LazySet{N}

Abstract type for polytopic sets, i.e., sets with finitely many flat facets, or equivalently, sets defined as an intersection of a finite number of halfspaces, or equivalently, sets with finitely many vertices.

Notes

Every concrete AbstractPolytope must define the following functions:

  • vertices_list(::AbstractPolytope{N})::Vector{Vector{N}} – return a list of all vertices

julia> subtypes(AbstractPolytope)
4-element Array{Union{DataType, UnionAll},1}:
 LazySets.AbstractPointSymmetricPolytope
 LazySets.AbstractPolygon
 LazySets.HPolytope
 LazySets.VPolytope
source

This interface defines the following functions:

linear_map(M::AbstractMatrix, P::AbstractPolytope{N}) where {N<:Real}

Concrete linear map of an abstract polytype.

Input

  • M – matrix

  • P – abstract polytype

Output

The polytope in V-representation obtained by applying the linear map $M$ to the set $P$. If the given polytope is two-dimensional, a polygon instead of a general polytope is returned.

source

Polygon

A polygon is a two-dimensional polytope.

AbstractPolygon{N<:Real} <: AbstractPolytope{N}

Abstract type for polygons (i.e., 2D polytopes).

Notes

Every concrete AbstractPolygon must define the following functions:

  • tovrep(::AbstractPolygon{N})::VPolygon{N} – transform into V-representation

  • tohrep(::AbstractPolygon{N})::AbstractHPolygon{N} – transform into H-representation

julia> subtypes(AbstractPolygon)
2-element Array{Union{DataType, UnionAll},1}:
 LazySets.AbstractHPolygon
 LazySets.VPolygon
source

HPolygon

An HPolygon is a polygon in H-representation (or constraint representation).

AbstractHPolygon{N<:Real} <: AbstractPolygon{N}

Abstract type for polygons in H-representation (i.e., constraints).

Notes

Every concrete AbstractHPolygon must have the following fields:

  • constraints::Vector{LinearConstraint{N}} – the constraints

New subtypes should be added to the convert method in order to be convertible.

julia> subtypes(AbstractHPolygon)
2-element Array{Union{DataType, UnionAll},1}:
 LazySets.HPolygon
 LazySets.HPolygonOpt
source

Point symmetric polytope

A point symmetric polytope is a combination of two other interfaces: Point symmetric set and Polytope.

AbstractPointSymmetricPolytope{N<:Real} <: AbstractPolytope{N}

Abstract type for point symmetric, polytopic sets. It combines the AbstractPointSymmetric and AbstractPolytope interfaces. Such a type combination is necessary as long as Julia does not support multiple inheritance.

Notes

Every concrete AbstractPointSymmetricPolytope must define the following functions:

  • from AbstractPointSymmetric:

    • center(::AbstractPointSymmetricPolytope{N})::Vector{N} – return the center point

  • from AbstractPolytope:

    • vertices_list(::AbstractPointSymmetricPolytope{N})::Vector{Vector{N}} – return a list of all vertices

julia> subtypes(AbstractPointSymmetricPolytope)
4-element Array{Union{DataType, UnionAll},1}:
 LazySets.AbstractHyperrectangle
 LazySets.Ball1
 LazySets.Interval
 LazySets.Zonotope
source

Hyperrectangle

A hyperrectangle is a special point symmetric polytope with axis-aligned facets.

AbstractHyperrectangle{N<:Real} <: AbstractPointSymmetricPolytope{N}

Abstract type for hyperrectangular sets.

Notes

Every concrete AbstractHyperrectangle must define the following functions:

  • radius_hyperrectangle(::AbstractHyperrectangle{N})::Vector{N} – return the hyperrectangle's radius, which is a full-dimensional vector

  • radius_hyperrectangle(::AbstractHyperrectangle{N}, i::Int)::N – return the hyperrectangle's radius in the i-th dimension

julia> subtypes(AbstractHyperrectangle)
4-element Array{Union{DataType, UnionAll},1}:
 LazySets.AbstractSingleton
 LazySets.BallInf
 LazySets.Hyperrectangle
 LazySets.SymmetricIntervalHull
source

Singleton

A singleton is a special hyperrectangle consisting of only one point.

AbstractSingleton{N<:Real} <: AbstractHyperrectangle{N}

Abstract type for sets with a single value.

Notes

Every concrete AbstractSingleton must define the following functions:

  • element(::AbstractSingleton{N})::Vector{N} – return the single element

  • element(::AbstractSingleton{N}, i::Int)::N – return the single element's entry in the i-th dimension

julia> subtypes(AbstractSingleton)
2-element Array{Union{DataType, UnionAll},1}:
 LazySets.Singleton
 LazySets.ZeroSet
source

This interface defines the following functions:

linear_map(M::AbstractMatrix, P::AbstractPolytope{N}) where {N<:Real}

Concrete linear map of an abstract polytype.

Input

  • M – matrix

  • P – abstract polytype

Output

The polytope in V-representation obtained by applying the linear map $M$ to the set $P$. If the given polytope is two-dimensional, a polygon instead of a general polytope is returned.

source
linear_map(M::AbstractMatrix, S::AbstractSingleton{N}) where {N<:Real}

Concrete linear map of an abstract singleton.

Input

  • M – matrix

  • S – abstract singleton

Output

The abstract singleton of the same type of $S$ obtained by applying the linear map to the element in $S$.

source