#2245 - Add constrained dimensions of a line
Closes https://github.com/JuliaReach/LazySets.jl/issues/2245.
Adding #2245 as i had done it already. Here the interpretation of a "constrained dimension" is that the set is bounded along the i-the dimension, otherwise it is "unconstrained". In fact, as discussed in #2245, for half-spaces the interpretation is the same.
On the other hand, one can't blindly apply the constrained_dimensions to the BFPSV19 algorithm implemented in Reachability.jl (not yet available in RA) because it requires equality with the projection of the set along the constrained dimensions, times the cartesian prod with the universal set in the unconstrained dimensions.. using a line, one only gets an overapproximation.
In fact, as discussed in #2245, for half-spaces the interpretation is the same.
julia> L = Line(ones(3), [1., 0., 1.]);
julia> constrained_dimensions(L) # implementation in master
3-element Array{Int64,1}:
1
2
3
julia> function constrained_dimensions2(L::Line) # implementation proposed here
return findall(LazySets.isapproxzero, L.d)
end
julia> constrained_dimensions2(L)
1-element Array{Int64,1}:
2
The definition in master returns those dimensions i such that at least one constraint is nonzero in dimension i.
julia> constraints_list(L)
4-element Array{HalfSpace{Float64,Array{Float64,1}},1}:
HalfSpace{Float64,Array{Float64,1}}([0.0, 1.0, 0.0], 1.0)
HalfSpace{Float64,Array{Float64,1}}([-0.0, -1.0, -0.0], -1.0)
HalfSpace{Float64,Array{Float64,1}}([-0.7071067811865475, 0.0, 0.7071067811865475], 0.0)
HalfSpace{Float64,Array{Float64,1}}([0.7071067811865475, -0.0, -0.7071067811865475], -0.0)
Ideas for names:
-> nonuniversal_dimensions: those dimensions i such that at least one constraint is nonzero in dimension i.
-> bounded_dimensions: the set is bounded along the i-th dimension (meaning that both rho(ei, X) and rho(-ei, X) are bounded).
Examples:
-
x >= 0in 2D the non-universal dimensions are [1] and the bounded dimensions are [].
Closing as stale.