JuliaReach/Reachability.jl

MethodError in reachset projection

mforets opened this issue ยท 0 comments

using Revise
using Reachability, MathematicalSystems, TaylorIntegration

# Equations of motion
# We write the function such that the operations are either unary or binary:
@taylorize function laubloomis!(dx, x, params, t)
    dx[1] = 1.4*x[3] - 0.9*x[1]
    dx[2] = 2.5*x[5] - 1.5*x[2]
    dx[3] = 0.6*x[7] - 0.8*(x[2]*x[3])
    dx[4] = 2 - 1.3*(x[3]*x[4])
    dx[5] = 0.7*x[1] - (x[4]*x[5])
    dx[6] = 0.3*x[1] - 3.1*x[6]
    dx[7] = 1.8*x[6] - 1.6*(x[2]*x[7])
    return dx
end

function laubloomis(; T=20.0, W=0.01, plot_vars=[0, 4],
                      property=(t,x)->x[4] < 4.5,
                      project_reachset=true)

    # equations, x' = f(x(t))
    ๐น = BlackBoxContinuousSystem(laubloomis!, 7)

    X0c = [1.2, 1.05, 1.5, 2.4, 1.0, 0.1, 0.45]
    X0 = Hyperrectangle(X0c, fill(W, 7))

    # instantiate the IVP
    ๐‘ƒ = InitialValueProblem(๐น, X0)

    # general options
    ๐‘‚ = Options(:T=>T, :plot_vars=>plot_vars, :property=>property,
                :project_reachset=>project_reachset, :mode=>"check")

    return (๐‘ƒ, ๐‘‚)
end

๐‘ƒ, ๐‘‚ = laubloomis(W=0.01, property=(t,x)->x[4] < 4.5, project_reachset=true)

๐‘‚โ‚ = Options(:abs_tol=>1e-10, :orderT=>7, :orderQ=>1, :max_steps=>1000)

# first run
sol_case_1 = solve(๐‘ƒ, ๐‘‚, op=TMJets(๐‘‚โ‚));

MethodError: Cannot `convert` an object of type Array{ReachSet{#s220} where #s220<:(Hyperrectangle{Float64,VNC,VNR} where VNR<:AbstractArray{Float64,1} where VNC<:AbstractArray{Float64,1}),1} to an object of type AbstractSolution
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

Stacktrace:
 [1] #solve!#40(::TMJets, ::typeof(Reachability.solve!), ::InitialValueProblem{BlackBoxContinuousSystem{typeof(laubloomis!)},Hyperrectangle{Float64,Array{Float64,1},Array{Float64,1}}}, ::Options) at /home/mforets/.julia/dev/Reachability/src/solve.jl:79
 [2] #solve#39 at ./none:0 [inlined]
 [3] (::getfield(Reachability, Symbol("#kw##solve")))(::NamedTuple{(:op,),Tuple{TMJets}}, ::typeof(solve), ::InitialValueProblem{BlackBoxContinuousSystem{typeof(laubloomis!)},Hyperrectangle{Float64,Array{Float64,1},Array{Float64,1}}}, ::Options) at ./none:0
 [4] top-level scope at In[5]:4