JuliaReach / Reachability.jl

Reachability and Safety of Nondeterministic Dynamical Systems
MIT License
50 stars 4 forks source link

MethodError with projection matrix #704

Closed mforets closed 4 years ago

mforets commented 4 years ago
# minimal instance
using Revise
using SparseArrays, Reachability, MathematicalSystems

A = sprandn(4, 4, 0.1)
S = LinearContinuousSystem(A)
M = rand(4, 4)
X0 = rand(Hyperrectangle, dim=4)
P = InitialValueProblem(S, X0);

solve(P, Options(:T=>1.0, :projection_matrix=>M), op=BFFPSV18(:δ=>0.1, :assume_sparse=>false));

MethodError: Cannot `convert` an object of type SparseReachSet{Hyperrectangle{Float64,Array{Float64,1},Array{Float64,1}}} to an object of type SparseReachSet{Hyperrectangle{Float64,VNC,VNR} where VNR<:AbstractArray{Float64,1} where VNC<:AbstractArray{Float64,1}}
Closest candidates are:
  convert(::Type{#s16} where #s16<:Union{Number, T}, !Matched::MultivariatePolynomials.AbstractPolynomialLike{T}) where T at /home/mforets/.julia/packages/MultivariatePolynomials/0oEYT/src/conversion.jl:15
  convert(::Type{T}, !Matched::T) where T at essentials.jl:167
  SparseReachSet{Hyperrectangle{Float64,VNC,VNR} where VNR<:AbstractArray{Float64,1} where VNC<:AbstractArray{Float64,1}}(::Any, !Matched::Any) where SN at /home/mforets/.julia/dev/Reachability/src/ReachSets/ReachSet.jl:49

Stacktrace:
 [1] setindex!(::Array{SparseReachSet{Hyperrectangle{Float64,VNC,VNR} where VNR<:AbstractArray{Float64,1} where VNC<:AbstractArray{Float64,1}},1}, ::SparseReachSet{Hyperrectangle{Float64,Array{Float64,1},Array{Float64,1}}}, ::Int64) at ./array.jl:766
 [2] store! at /home/mforets/.julia/dev/Reachability/src/ReachSets/ContinuousPost/BFFPSV18/reach_blocks.jl:41 [inlined]
 [3] reach_blocks!(::Array{Float64,2}, ::Array{LazySet{Float64},1}, ::Nothing, ::getfield(Reachability.ReachSets, Symbol("##48#52")){Array{Type{#s123} where #s123<:LazySet,1}}, ::getfield(Reachability.ReachSets, Symbol("##50#54")), ::Int64, ::Int64, ::getfield(Reachability.ReachSets, Symbol("##47#51")){Reachability.TwoLayerOptions}, ::Array{Int64,1}, ::Array{Int64,1}, ::Array{Int64,1}, ::Float64, ::getfield(Reachability.ReachSets, Symbol("##58#59")){Int64}, ::ProgressMeter.Progress, ::Array{SparseReachSet{Hyperrectangle{Float64,VNC,VNR} where VNR<:AbstractArray{Float64,1} where VNC<:AbstractArray{Float64,1}},1}) at /home/mforets/.julia/dev/Reachability/src/ReachSets/ContinuousPost/BFFPSV18/reach_blocks.jl:159
 [4] macro expansion at /home/mforets/.julia/dev/Reachability/src/ReachSets/ContinuousPost/BFFPSV18/reach.jl:193 [inlined]
 [5] macro expansion at /home/mforets/.julia/dev/Reachability/src/logging.jl:83 [inlined]
 [6] reach(::InitialValueProblem{ConstrainedLinearDiscreteSystem{Float64,Array{Float64,2},Universe{Float64}},ConvexHull{Float64,Hyperrectangle{Float64,Array{Float64,1},Array{Float64,1}},MinkowskiSum{Float64,LazySets.LinearMap{Float64,Hyperrectangle{Float64,Array{Float64,1},Array{Float64,1}},Float64,Array{Float64,2}},Hyperrectangle{Float64,Array{Float64,1},Array{Float64,1}}}}}, ::Reachability.TwoLayerOptions) at /home/mforets/.julia/dev/Reachability/src/ReachSets/ContinuousPost/BFFPSV18/reach.jl:192
 [7] reach(::InitialValueProblem{ConstrainedLinearContinuousSystem{Float64,SparseMatrixCSC{Float64,Int64},Universe{Float64}},Hyperrectangle{Float64,Array{Float64,1},Array{Float64,1}}}, ::Reachability.TwoLayerOptions) at /home/mforets/.julia/dev/Reachability/src/ReachSets/ContinuousPost/BFFPSV18/reach.jl:216
 [8] macro expansion at /home/mforets/.julia/dev/Reachability/src/ReachSets/ContinuousPost/BFFPSV18/BFFPSV18.jl:251 [inlined]
 [9] post(::BFFPSV18, ::InitialValueProblem{ConstrainedLinearContinuousSystem{Float64,SparseMatrixCSC{Float64,Int64},Universe{Float64}},Hyperrectangle{Float64,Array{Float64,1},Array{Float64,1}}}, ::Options) at /home/mforets/.julia/dev/Reachability/src/ReachSets/ContinuousPost/BFFPSV18/BFFPSV18.jl:250
 [10] #solve!#40(::BFFPSV18, ::typeof(Reachability.solve!), ::InitialValueProblem{LinearContinuousSystem{Float64,SparseMatrixCSC{Float64,Int64}},Hyperrectangle{Float64,Array{Float64,1},Array{Float64,1}}}, ::Options) at /home/mforets/.julia/dev/Reachability/src/solve.jl:74
 [11] #solve#39 at ./none:0 [inlined]
 [12] (::getfield(Reachability, Symbol("#kw##solve")))(::NamedTuple{(:op,),Tuple{BFFPSV18}}, ::typeof(solve), ::InitialValueProblem{LinearContinuousSystem{Float64,SparseMatrixCSC{Float64,Int64}},Hyperrectangle{Float64,Array{Float64,1},Array{Float64,1}}}, ::Options) at ./none:0
 [13] top-level scope at In[29]:1
solve(P, Options(:T=>1.0, :projection_matrix=>M), op=BFFPSV18(:δ=>0.1, :assume_sparse=>true));

MethodError: Cannot `convert` an object of type SparseReachSet{Hyperrectangle{Float64,Array{Float64,1},Array{Float64,1}}} to an object of type SparseReachSet{Hyperrectangle{Float64,VNC,VNR} where VNR<:AbstractArray{Float64,1} where VNC<:AbstractArray{Float64,1}}
Closest candidates are:
  convert(::Type{#s16} where #s16<:Union{Number, T}, !Matched::MultivariatePolynomials.AbstractPolynomialLike{T}) where T at /home/mforets/.julia/packages/MultivariatePolynomials/0oEYT/src/conversion.jl:15
  convert(::Type{T}, !Matched::T) where T at essentials.jl:167
  SparseReachSet{Hyperrectangle{Float64,VNC,VNR} where VNR<:AbstractArray{Float64,1} where VNC<:AbstractArray{Float64,1}}(::Any, !Matched::Any) where SN at /home/mforets/.julia/dev/Reachability/src/ReachSets/ReachSet.jl:49

Stacktrace:
 [1] setindex!(::Array{SparseReachSet{Hyperrectangle{Float64,VNC,VNR} where VNR<:AbstractArray{Float64,1} where VNC<:AbstractArray{Float64,1}},1}, ::SparseReachSet{Hyperrectangle{Float64,Array{Float64,1},Array{Float64,1}}}, ::Int64) at ./array.jl:766
 [2] store! at /home/mforets/.julia/dev/Reachability/src/ReachSets/ContinuousPost/BFFPSV18/reach_blocks.jl:41 [inlined]
 [3] reach_blocks!(::SparseMatrixCSC{Float64,Int64}, ::Array{LazySet{Float64},1}, ::Nothing, ::getfield(Reachability.ReachSets, Symbol("##48#52")){Array{Type{#s123} where #s123<:LazySet,1}}, ::getfield(Reachability.ReachSets, Symbol("##50#54")), ::Int64, ::Int64, ::getfield(Reachability.ReachSets, Symbol("##47#51")){Reachability.TwoLayerOptions}, ::Array{Int64,1}, ::Array{Int64,1}, ::Array{Int64,1}, ::Float64, ::getfield(Reachability.ReachSets, Symbol("##58#59")){Int64}, ::ProgressMeter.Progress, ::Array{SparseReachSet{Hyperrectangle{Float64,VNC,VNR} where VNR<:AbstractArray{Float64,1} where VNC<:AbstractArray{Float64,1}},1}) at /home/mforets/.julia/dev/Reachability/src/ReachSets/ContinuousPost/BFFPSV18/reach_blocks.jl:71
 [4] macro expansion at /home/mforets/.julia/dev/Reachability/src/ReachSets/ContinuousPost/BFFPSV18/reach.jl:193 [inlined]
 [5] macro expansion at /home/mforets/.julia/dev/Reachability/src/logging.jl:83 [inlined]
 [6] reach(::InitialValueProblem{ConstrainedLinearDiscreteSystem{Float64,Array{Float64,2},Universe{Float64}},ConvexHull{Float64,Hyperrectangle{Float64,Array{Float64,1},Array{Float64,1}},MinkowskiSum{Float64,LazySets.LinearMap{Float64,Hyperrectangle{Float64,Array{Float64,1},Array{Float64,1}},Float64,Array{Float64,2}},Hyperrectangle{Float64,Array{Float64,1},Array{Float64,1}}}}}, ::Reachability.TwoLayerOptions) at /home/mforets/.julia/dev/Reachability/src/ReachSets/ContinuousPost/BFFPSV18/reach.jl:192
 [7] reach(::InitialValueProblem{ConstrainedLinearContinuousSystem{Float64,SparseMatrixCSC{Float64,Int64},Universe{Float64}},Hyperrectangle{Float64,Array{Float64,1},Array{Float64,1}}}, ::Reachability.TwoLayerOptions) at /home/mforets/.julia/dev/Reachability/src/ReachSets/ContinuousPost/BFFPSV18/reach.jl:216
 [8] macro expansion at /home/mforets/.julia/dev/Reachability/src/ReachSets/ContinuousPost/BFFPSV18/BFFPSV18.jl:251 [inlined]
 [9] post(::BFFPSV18, ::InitialValueProblem{ConstrainedLinearContinuousSystem{Float64,SparseMatrixCSC{Float64,Int64},Universe{Float64}},Hyperrectangle{Float64,Array{Float64,1},Array{Float64,1}}}, ::Options) at /home/mforets/.julia/dev/Reachability/src/ReachSets/ContinuousPost/BFFPSV18/BFFPSV18.jl:250
 [10] #solve!#40(::BFFPSV18, ::typeof(Reachability.solve!), ::InitialValueProblem{LinearContinuousSystem{Float64,SparseMatrixCSC{Float64,Int64}},Hyperrectangle{Float64,Array{Float64,1},Array{Float64,1}}}, ::Options) at /home/mforets/.julia/dev/Reachability/src/solve.jl:74
 [11] #solve#39 at ./none:0 [inlined]
 [12] (::getfield(Reachability, Symbol("#kw##solve")))(::NamedTuple{(:op,),Tuple{BFFPSV18}}, ::typeof(solve), ::InitialValueProblem{LinearContinuousSystem{Float64,SparseMatrixCSC{Float64,Int64}},Hyperrectangle{Float64,Array{Float64,1},Array{Float64,1}}}, ::Options) at ./none:0
 [13] top-level scope at In[30]:1