Translation

Translation

Translation{N<:Real, VN<:AbstractVector{N},
            S<:LazySet{N}} <: AbstractAffineMap{N, S}

Type that represents a lazy translation.

The translation of set X along vector v is the map:

\[x ↦ x + v,\qquad x ∈ X\]

A translation is a special case of an affine map $A x + b, x ∈ X$ where the linear map $A$ is the identity matrix and the translation vector $b = v$.

Fields

  • X – convex set
  • v – vector that defines the translation

Example

julia> X = BallInf([2.0, 2.0, 2.0], 1.0);

julia> v = [1.0, 0.0, 0.0]; # translation along dimension 1

julia> tr = Translation(X, v);

julia> typeof(tr)
Translation{Float64,Array{Float64,1},BallInf{Float64,Array{Float64,1}}}

julia> tr.X
BallInf{Float64,Array{Float64,1}}([2.0, 2.0, 2.0], 1.0)

julia> tr.v
3-element Array{Float64,1}:
 1.0
 0.0
 0.0

The sum operator + is overloaded to create translations:

julia> X + v == Translation(X, v)
true

And so does the Minkowski sum operator, :

julia> X ⊕ v == Translation(X, v)
true

The translation of a translation is performed immediately:

julia> tr = (X+v)+v
Translation{Float64,Array{Float64,1},BallInf{Float64,Array{Float64,1}}}(BallInf{Float64,Array{Float64,1}}([2.0, 2.0, 2.0], 1.0), [2.0, 0.0, 0.0])

julia> tr.v
3-element Array{Float64,1}:
 2.0
 0.0
 0.0

The dimension of a translation is obtained with the dim function:

julia> dim(tr)
3

For the support vector (resp. support function) along vector d, use σ and ρ respectively:

julia> σ([1.0, 0.0, 0.0], tr)
3-element Array{Float64,1}:
 5.0
 3.0
 3.0

julia> ρ([1.0, 0.0, 0.0], tr)
5.0

See the docstring of each of these functions for details.

The an_element function is useful to obtain an element of a translation:

julia> e = an_element(tr)
3-element Array{Float64,1}:
 4.0
 2.0
 2.0

The lazy linear map of a translation is an affine map, since the following simplification rule applies: $M * (X ⊕ v) = (M * X) ⊕ (M * v)$:

julia> using LinearAlgebra: I

julia> M = Matrix(2.0I, 3, 3);

julia> Q = M * tr;

julia> Q isa AffineMap && Q.M == M && Q.X == tr.X && Q.v == 2 * tr.v
true

Use the isempty method to query if the translation is empty; it falls back to the isempty method of the wrapped set:

julia> isempty(tr)
false

The list of constraints of the translation of a polyhedron (in general, a set whose constraints_list is available) can be computed from a lazy translation:

julia> constraints_list(tr)
6-element Array{HalfSpace{Float64,LazySets.Arrays.SingleEntryVector{Float64}},1}:
 HalfSpace{Float64,LazySets.Arrays.SingleEntryVector{Float64}}([1.0, 0.0, 0.0], 5.0)
 HalfSpace{Float64,LazySets.Arrays.SingleEntryVector{Float64}}([0.0, 1.0, 0.0], 3.0)
 HalfSpace{Float64,LazySets.Arrays.SingleEntryVector{Float64}}([0.0, 0.0, 1.0], 3.0)
 HalfSpace{Float64,LazySets.Arrays.SingleEntryVector{Float64}}([-1.0, 0.0, 0.0], -3.0)
 HalfSpace{Float64,LazySets.Arrays.SingleEntryVector{Float64}}([0.0, -1.0, 0.0], -1.0)
 HalfSpace{Float64,LazySets.Arrays.SingleEntryVector{Float64}}([0.0, 0.0, -1.0], -1.0)
source
Base.:+Method.
+(X::LazySet, v::AbstractVector)

Convenience constructor for a translation.

Input

  • X – convex set
  • v – vector

Output

The symbolic translation of $X$ along vector $v$.

source
LazySets.:⊕Method.
⊕(X::LazySet, v::AbstractVector)

Unicode alias constructor ⊕ (oplus) for the lazy translation operator.

source
LazySets.ρMethod.
ρ(d::AbstractVector{N}, tr::Translation{N}) where {N<:Real}

Return the support function of a translation.

Input

  • d – direction
  • tr – translation

Output

The support function in the given direction.

source
LazySets.σMethod.
σ(d::AbstractVector{N}, tr::Translation{N}) where {N<:Real}

Return the support vector of a translation.

Input

  • d – direction
  • tr – translation

Output

The support vector in the given direction. If the direction has norm zero, the result depends on the wrapped set.

source
an_element(tr::Translation)

Return some element of a translation.

Input

  • tr – translation

Output

An element in the translation.

Notes

This function first asks for an_element function of the wrapped set, then translates this element according to the given translation vector.

source
constraints_list(tr::Translation{N}) where {N<:Real}

Return the list of constraints of the translation of a set.

Input

  • tr – lazy translation of a polyhedron

Output

The list of constraints of the translation.

Notes

We assume that the set wrapped by the lazy translation X offers a method constraints_list(⋅).

Algorithm

Let the translation be defined by the set of points y such that y = x + v for all x ∈ X. Then, each defining halfspace a⋅x ≤ b is transformed to a⋅y ≤ b + a⋅v.

source
linear_map(M::AbstractMatrix{N}, tr::Translation{N}) where {N<:Real}

Concrete linear map of a polyhedron in constraint representation.

Input

  • M – matrix
  • tr – translation of a convex set

Output

A concrete set corresponding to the linear map. The type of the result depends on the type of the set wrapped by tr.

Algorithm

We compute translate(linear_map(M, tr.X), M * tr.v).

source
Base.:∈Method.
∈(x::AbstractVector{N}, tr::Translation{N}) where {N<:Real}

Check whether a given point is contained in the translation of a convex set.

Input

  • x – point/vector
  • tr – translation of a convex set

Output

true iff $x ∈ tr$.

Algorithm

This implementation relies on the set membership function for the wrapped set tr.X, since $x ∈ X ⊕ v$ iff $x - v ∈ X$.

source

Inherited from AbstractAffineMap:

Inherited from LazySet: