-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#512 - Add new option to discretize #528
Conversation
A = sparse([1, 1, 2, 3, 4], [1, 2, 2, 4, 3], [1., 2., 3., 4., 5.], 4, 4)
X0 = BallInf(zeros(4), 0.1)
cont_sys_homog = IVP(LCS(A), X0)
δ = 0.01
julia> discr_sys_homog = discretize(cont_sys_homog, δ, algorithm="forward", set_operations="zonotope")
ERROR: MethodError: no method matching minkowski_sum(::BallInf{Float64}, ::Zonotope{Float64})
Closest candidates are:
minkowski_sum(::Zonotope{N<:Real}, ::Zonotope{N<:Real}) where N<:Real at /Users/forets/.julia/dev/LazySets/src/Zonotope.jl:330
Stacktrace:
[1] _discretize_interpolation_homog(::BallInf{Float64}, ::Array{Float64,2}, ::Hyperrectangle{Float64}, ::Val{:zonotope}) at /Users/forets/.julia/dev/Reachability/src/ReachSets/discretize.jl:6
92
[2] #discretize_interpolation#9(::String, ::String, ::String, ::String, ::Function, ::InitialValueProblem{LinearContinuousSystem{Float64,SparseMatrixCSC{Float64,Int64}},BallInf{Float64}}, ::F
loat64) at /Users/forets/.julia/dev/Reachability/src/ReachSets/discretize.jl:648
[3] #discretize_interpolation at ./none:0 [inlined]
[4] #discretize#1(::String, ::String, ::String, ::String, ::Function, ::InitialValueProblem{LinearContinuousSystem{Float64,SparseMatrixCSC{Float64,Int64}},BallInf{Float64}}, ::Float64) at /Us
ers/forets/.julia/dev/Reachability/src/ReachSets/discretize.jl:100
[5] (::getfield(Reachability.ReachSets, Symbol("#kw##discretize")))(::NamedTuple{(:algorithm, :set_operations),Tuple{String,String}}, ::typeof(discretize), ::InitialValueProblem{LinearContinu
ousSystem{Float64,SparseMatrixCSC{Float64,Int64}},BallInf{Float64}}, ::Float64) at ./none:0
[6] top-level scope at none:0 |
I think generally the code cannot assume that the initial states are given as a zonotope or related sets, right? So you need to call |
Agreed, i was just about to comment on that. I have been assuming that the initial states are hyperrectangular for which we have a good conversion. Changing to julia> H = rand(Hyperrectangle, dim=10);
julia> convert(Zonotope, H);
julia> using LazySets.Approximations
julia> overapproximate(H, Zonotope);
ERROR: MethodError: no method matching overapproximate(::Hyperrectangle{Float64}, ::Type{Zonotope})
Closest candidates are:
overapproximate(::LazySet{N<:Real}, ::Type{#s65} where #s65<:HPolygon) where N<:Real at /Users/forets/.julia/dev/LazySets/src/Approximations/overapproximate.jl:42
overapproximate(::LazySet{N<:Real}, ::Type{#s35} where #s35<:HPolygon, ::Real) where N<:Real at /Users/forets/.julia/dev/LazySets/src/Approximations/overapproximate.jl:42
overapproximate(::ConvexHull{N<:Real,Zonotope{N<:Real},Zonotope{N<:Real}}, ::Type{#s66} where #s66<:Zonotope) where N<:Real at /Users/forets/.julia/dev/LazySets/src/Approximations/overapproximate.jl:195
...
Stacktrace:
[1] top-level scope at none:0 |
We can also keep |
I kept convert and added tests for the homogeneous and the constant case. |
Opened #530 as follow-up for the cases where the sets are not convertible to Zonotope. |
Thanks for the review ♻️ |
Closes #512.