# Universe

`LazySets.Universe`

— Type`Universe{N} <: AbstractPolyhedron{N}`

Type that represents the universal set, i.e., the set of all elements.

`LazySets.dim`

— Method`dim(U::Universe)`

Return the dimension of a universe.

**Input**

`U`

– universe

**Output**

The dimension of a universe.

`LazySets.ρ`

— Method`ρ(d::AbstractVector, U::Universe)`

Return the support function of a universe.

**Input**

`d`

– direction`U`

– universe

**Output**

The support function in the given direction.

**Algorithm**

If the direction is all zero, the result is zero. Otherwise, the result is `Inf`

.

`LazySets.σ`

— Method`σ(d::AbstractVector, U::Universe)`

Return the support vector of a universe.

**Input**

`d`

– direction`U`

– universe

**Output**

A vector with infinity values, except in dimensions where the direction is zero.

`Base.:∈`

— Method`∈(x::AbstractVector, U::Universe)`

Check whether a given point is contained in a universe.

**Input**

`x`

– point/vector`U`

– universe

**Output**

The output is always `true`

.

**Examples**

```
julia> [1.0, 0.0] ∈ Universe(2)
true
```

`Base.rand`

— Method```
rand(::Type{Universe}; [N]::Type{<:Real}=Float64, [dim]::Int=2,
[rng]::AbstractRNG=GLOBAL_RNG, [seed]::Union{Int, Nothing}=nothing)
```

Create a universe (note that there is nothing to randomize).

**Input**

`Universe`

– type for dispatch`N`

– (optional, default:`Float64`

) numeric type`dim`

– (optional, default: 2) dimension`rng`

– (optional, default:`GLOBAL_RNG`

) random number generator`seed`

– (optional, default:`nothing`

) seed for reseeding

**Output**

The (only) universe of the given numeric type and dimension.

`LazySets.an_element`

— Method`an_element(S::ConvexSet{N}) where {N}`

Return some element of a convex set.

**Input**

`S`

– convex set

**Output**

An element of a convex set.

**Algorithm**

An element of the set is obtained by evaluating its support vector along direction $[1, 0, …, 0]$.

```
an_element(P::AbstractPolyhedron{N};
[solver]=default_lp_solver(N)) where {N}
```

Return some element of a polyhedron.

**Input**

`P`

– polyhedron`solver`

– (optional, default:`default_lp_solver(N)`

) LP solver

**Output**

An element of the polyhedron, or an error if the polyhedron is empty.

**Algorithm**

An element of the polyhedron is obtained by solving a feasibility linear program.

`an_element(L::Line2D{N}) where {N}`

Return some element of a line.

**Input**

`L`

– line

**Output**

An element on the line.

**Algorithm**

If the $b$ value of the line is zero, the result is the origin. Otherwise the result is some $x = [x1, x2]$ such that $a·[x1, x2] = b$. We first find out in which dimension $a$ is nonzero, say, dimension 1, and then choose $x1 = 1$ and accordingly $x2 = \frac{b - a1}{a2}$.

`an_element(U::Universe{N}) where {N}`

Return some element of a universe.

**Input**

`U`

– universe

**Output**

The origin.

`Base.isempty`

— Method`isempty(U::Universe)`

Return if a universe is empty or not.

**Input**

`U`

– universe

**Output**

`false`

.

`LazySets.isbounded`

— Method`isbounded(U::Universe)`

Determine whether a universe is bounded.

**Input**

`U`

– universe

**Output**

`false`

as the universe is unbounded.

`LazySets.isuniversal`

— Method`isuniversal(U::Universe{N}, [witness]::Bool=false) where {N}`

Check whether a universe is universal.

**Input**

`U`

– universe`witness`

– (optional, default:`false`

) compute a witness if activated

**Output**

- If
`witness`

option is deactivated:`true`

- If
`witness`

option is activated:`(true, [])`

`LinearAlgebra.norm`

— Function`norm(U::Universe, [p]::Real=Inf)`

Return the norm of a universe. It is the norm of the enclosing ball (of the given $p$-norm) of minimal volume that is centered in the origin.

**Input**

`U`

– universe`p`

– (optional, default:`Inf`

) norm

**Output**

An error.

`IntervalArithmetic.radius`

— Function`radius(U::Universe, [p]::Real=Inf)`

Return the radius of a universe. It is the radius of the enclosing ball (of the given $p$-norm) of minimal volume with the same center.

**Input**

`U`

– universe`p`

– (optional, default:`Inf`

) norm

**Output**

An error.

`LazySets.diameter`

— Function`diameter(U::Universe, [p]::Real=Inf)`

Return the diameter of a universe. It is the maximum distance between any two elements of the set, or, equivalently, the diameter of the enclosing ball (of the given $p$-norm) of minimal volume with the same center.

**Input**

`U`

– universe`p`

– (optional, default:`Inf`

) norm

**Output**

An error.

`LazySets.constraints`

— Method`constraints_list(U::Universe{N}) where {N}`

Construct an iterator over the constraints of a universe.

**Input**

`U`

– universe

**Output**

The empty iterator, as the universe is unconstrained.

`LazySets.constraints_list`

— Method`constraints_list(H::AbstractHyperrectangle{N}) where {N}`

Return the list of constraints of an axis-aligned hyperrectangular set.

**Input**

`H`

– hyperrectangular set

**Output**

A list of linear constraints.

`constraints_list(P::Ball1{N}) where {N}`

Return the list of constraints defining a ball in the 1-norm.

**Input**

`B`

– ball in the 1-norm

**Output**

The list of constraints of the ball.

**Algorithm**

The constraints can be defined as $d_i^T (x-c) ≤ r$ for all $d_i$, where $d_i$ is a vector with elements $1$ or $-1$ in $n$ dimensions. To span all possible $d_i$, the function `Iterators.product`

is used.

`constraints_list(x::Interval{N}) where {N}`

Return the list of constraints of the given interval.

**Input**

`x`

– interval

**Output**

The list of constraints of the interval represented as two one-dimensional half-spaces.

`constraints_list(L::Line{N, VN}) where {N, VN}`

Return the list of constraints of a line.

**Input**

`L`

– line

**Output**

A list containing `2n-2`

half-spaces whose intersection is `L`

, where `n`

is the ambient dimension of `L`

.

`constraints_list(U::Universe{N}) where {N}`

Return the list of constraints defining a universe.

**Input**

`U`

– universe

**Output**

The empty list of constraints, as the universe is unconstrained.

`constraints_list(P::HParallelotope{N, VN}) where {N, VN}`

Return the list of constraints of the given parallelotope.

**Input**

`P`

– parallelotope in constraint representation

**Output**

The list of constraints of `P`

.

constraints_list(cpa::CartesianProductArray{N}) where {N}

Return the list of constraints of a (polyhedral) Cartesian product of a finite number of sets.

**Input**

`cpa`

– Cartesian product array

**Output**

A list of constraints.

`constraints_list(ia::IntersectionArray{N}) where {N}`

Return the list of constraints of an intersection of a finite number of (polyhedral) sets.

**Input**

`ia`

– intersection of a finite number of (polyhedral) sets

**Output**

The list of constraints of the intersection.

**Notes**

We assume that the underlying sets are polyhedral, i.e., offer a method `constraints_list`

.

**Algorithm**

We create the polyhedron from the `constraints_list`

s of the sets and remove redundant constraints.

`constraints_list(rm::ResetMap{N}) where {N}`

Return the list of constraints of a polytopic reset map.

**Input**

`rm`

– reset map of a polytope

**Output**

The list of constraints of the reset map.

**Notes**

We assume that the underlying set `X`

is a polytope, i.e., is bounded and offers a method `constraints_list(X)`

.

**Algorithm**

We fall back to `constraints_list`

of a `LinearMap`

of the `A`

-matrix in the affine-map view of a reset map. Each reset dimension $i$ is projected to zero, expressed by two constraints for each reset dimension. Then it remains to shift these constraints to the new value.

For instance, if the dimension $5$ was reset to $4$, then there will be constraints $x₅ ≤ 0$ and $-x₅ ≤ 0$. We then modify the right-hand side of these constraints to $x₅ ≤ 4$ and $-x₅ ≤ -4$, respectively.

`constraints_list(rm::ResetMap{N, S}) where {N, S<:AbstractHyperrectangle}`

Return the list of constraints of a hyperrectangular reset map.

**Input**

`rm`

– reset map of a hyperrectangular set

**Output**

The list of constraints of the reset map.

**Algorithm**

We iterate through all dimensions. If there is a reset, we construct the corresponding (flat) constraints. Otherwise, we construct the corresponding constraints of the underlying set.

`LazySets.constrained_dimensions`

— Method`constrained_dimensions(U::Universe)`

Return the indices in which a universe is constrained.

**Input**

`U`

– universe

**Output**

The empty vector, as the universe is unconstrained in every dimension.

`LazySets.translate`

— Method`translate(U::Universe, v::AbstractVector)`

Translate (i.e., shift) a universe by a given vector.

**Input**

`U`

– universe`v`

– translation vector

**Output**

The universe.

`Polyhedra.polyhedron`

— Method`polyhedron(U::Universe; [backend]=default_polyhedra_backend(P))`

Return an `HRep`

polyhedron from `Polyhedra.jl`

given a universe.

**Input**

`U`

– universe`backend`

– (optional, default: call`default_polyhedra_backend(P)`

) the polyhedral computations backend

**Output**

An `HRep`

polyhedron.

**Notes**

For further information on the supported backends see Polyhedra's documentation.