Balls in the p-norm (AbstractBallp)
A ball is a centrally-symmetric set with a characteristic p-norm.
LazySets.AbstractBallp — TypeAbstractBallp{N} <: AbstractCentrallySymmetric{N}Abstract type for p-norm balls.
Notes
See Ballp for a standard implementation of this interface.
Every concrete AbstractBallp must define the following methods:
ball_norm(::AbstractBallp)– return the characteristic normradius_ball(::AbstractBallp)– return the ball radius
The subtypes of AbstractBallp:
julia> subtypes(AbstractBallp)
2-element Vector{Any}:
Ball2
BallpThere are two further set types implementing the AbstractBallp interface, but they also implement other interfaces and hence cannot be subtypes: Ball1 and BallInf.
This interface requires to implement the following functions:
LazySets.ball_norm — Methodball_norm(B::AbstractBallp)Determine the norm (p) of a p-norm ball.
Input
B– p-norm ball
Output
A number representing the norm.
LazySets.radius_ball — Methodradius_ball(B::AbstractBallp)Compute the radius of a p-norm ball.
Input
B– p-norm ball
Output
A number representing the radius.
This interface defines the following functions:
Base.:∈ — Method∈(x::AbstractVector, X::LazySet)Check whether a point lies in a set.
Input
x– point/vectorX– set
Output
true iff $x ∈ X$.
Base.:∈ — MethodExtended help
∈(x::AbstractVector, B::AbstractBallp)Notes
This implementation is worst-case optimized, i.e., it is optimistic and first computes (see below) the whole sum before comparing to the radius. In applications where the point is typically far away from the ball, a fail-fast implementation with interleaved comparisons could be more efficient.
Algorithm
Let $B$ be an $n$-dimensional ball in the p-norm with radius $r$ and let $c_i$ and $x_i$ be the ball's center and the vector $x$ in dimension $i$, respectively. Then $x ∈ B$ iff $\left( ∑_{i=1}^n |c_i - x_i|^p \right)^{1/p} ≤ r$.
Examples
julia> B = Ballp(1.5, [1.0, 1.0], 1.)
Ballp{Float64, Vector{Float64}}(1.5, [1.0, 1.0], 1.0)
julia> [0.5, -0.5] ∈ B
false
julia> [0.5, 1.5] ∈ B
trueLazySets.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.ρ — MethodExtended help
ρ(d::AbstractVector, B::AbstractBallp)Algorithm
Let $c$ and $r$ be the center and radius of the ball $B$ in the p-norm, respectively, and let $q = \frac{p}{p-1}$. Then:
\[ρ(d, B) = ⟨d, c⟩ + r ‖d‖_q.\]
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.σ — MethodExtended help
σ(d::AbstractVector, B::AbstractBallp)Algorithm
The support vector of the unit ball in the $p$-norm along direction $d$ is:
\[σ(d, \mathcal{B}_p^n(0, 1)) = \dfrac{\tilde{v}}{‖\tilde{v}‖_q},\]
where $\tilde{v}_i = \frac{|d_i|^q}{d_i}$ if $d_i ≠ 0$ and $\tilde{v}_i = 0$ otherwise, for all $i=1,…,n$, and $q$ is the conjugate number of $p$. By the affine transformation $x = r\tilde{x} + c$, one obtains that the support vector of $\mathcal{B}_p^n(c, r)$ is
\[σ(d, \mathcal{B}_p^n(c, r)) = \dfrac{v}{‖v‖_q},\]
where $v_i = c_i + r\frac{|d_i|^q}{d_i}$ if $d_i ≠ 0$ and $v_i = 0$ otherwise, for all $i = 1, …, n$.
If the direction has norm zero, the center of the ball is returned.
Undocumented implementations:
Inherited from LazySet:
areachebyshev_center_radiuscomplementconcretizeconstraintsconvex_hullcopy(::Type{LazySet})diametereltypeeltypeisoperationispolyhedralispolyhedraltypeispolytopicnormpolyhedronradiusrationalizerectifyreflectsingleton_listtosimplehreptriangulatetriangulate_facesverticesaffine_mapexponential_mapis_interior_pointlinear_mapprojectsamplescaletranslatecartesian_productconvex_hullexact_sumisapproxisdisjoint==isequivalent⊂⊆minkowski_differenceminkowski_sum
Inherited from ConvexSet:
Inherited from AbstractCentrallySymmetric: