-
Notifications
You must be signed in to change notification settings - Fork 38
Closed
Description
I'm working on a package https://github.com/sisl/POMDPModelChecking.jl
I could run an example code provided in the link above bug-free, but when I tried to debug through it, the following error message occurred. Does anyone know what the problem is? Thanks in advance!
To reproduce the bug
please follow the installation instructions of POMDPModelChecking.jl.
I set the breakpoint at the line policy = solve(solver, pomdp), first step into method POMDPs.solve in model_checking_solver.jl then method DeterministicRabinAutomata in rabin_automata.jl then Next line.
Version
macOS 10.15.5
Julia 1.3.1
(v1.3) pkg> st
Status `~/.julia/environments/v1.3/Project.toml`
[c52e3926] Atom v0.12.18
[a0b5b9ef] Cxx v0.4.0
[7073ff75] IJulia v1.21.2
[e5e0dc1b] Juno v0.8.2
[7f35509c] POMDPGifs v0.1.0
[abefb91b] POMDPModelChecking v0.0.0
[355abbd5] POMDPModels v0.4.9
[e0d0a172] POMDPSimulators v0.3.1
[a93abf59] POMDPs v0.8.4
[de008ff0] RockSample v0.1.1 #master (https://github.com/JuliaPOMDP/RockSample.jl)
[cef570c6] SARSOP v0.5.2
[f11abc24] Spot v0.1.0
Example code
using POMDPs
using Spot # for easy LTL manipulation
using POMDPModelChecking
using SARSOP # a POMDP solver from POMDPs.jl
using RockSample # pomdp model from https://github.com/JuliaPOMDP/RockSample.jl
# Init problem
pomdp = RockSamplePOMDP{3}(map_size=(5,5),
rocks_positions=[(2,3), (4,4), (4,2)])
## Probability of getting at least one good rock
# Implement the labeling function for your problem
# For the rock sample problem, good_rock holds true if the robot is on a good rock location
# and take the action `sample` (a=5)
# similarly, bad_rock holds true if the robot samples a bad rock
# The exit proposition is true if the robot reached a terminal state
function POMDPModelChecking.labels(pomdp::RockSamplePOMDP, s::RSState, a::Int64)
if a == 5 && in(s.pos, pomdp.rocks_positions) # sample rock
rock_ind = findfirst(isequal(s.pos), pomdp.rocks_positions)
if s.rocks[rock_ind]
return (:good_rock,)
else
return (:bad_rock,)
end
end
if isterminal(pomdp, s)
return (:exit,)
end
return ()
end
# the property to statisfy, the robot must pick up a good rock, never pick up a bad rock,
# and leave the environment
prop = ltl"F good_rock & F exit & G !bad_rock"
solver = ModelCheckingSolver(property = prop,
solver=SARSOPSolver(precision=1e-3), verbose=true)
policy = solve(solver, pomdp)
Stacktrace
debug> ERROR: BoundsError: attempt to access 4-element Array{Any,1} at index [5]
Stacktrace:
[1] getindex at ./array.jl:744 [inlined]
[2] build_compiled_call!(::Expr, ::Function, ::Core.CodeInfo, ::Int64, ::Int64, ::Array{Symbol,1}, ::Module) at /Users/UserName/.julia/packages/JuliaInterpreter/RmxVj/src/optimize.jl:343
[3] optimize!(::Core.CodeInfo, ::Method) at /Users/UserName/.julia/packages/JuliaInterpreter/RmxVj/src/optimize.jl:179
[4] #FrameCode#1(::Bool, ::Bool, ::Type{JuliaInterpreter.FrameCode}, ::Method, ::Core.CodeInfo) at /Users/UserName/.julia/packages/JuliaInterpreter/RmxVj/src/types.jl:101
[5] Type at ./none:0 [inlined]
[6] #prepare_framecode#35(::Bool, ::typeof(JuliaInterpreter.prepare_framecode), ::Method, ::Any) at /Users/UserName/.julia/packages/JuliaInterpreter/RmxVj/src/construct.jl:190
[7] (::JuliaInterpreter.var"#kw##prepare_framecode")(::NamedTuple{(:enter_generated,),Tuple{Bool}}, ::typeof(JuliaInterpreter.prepare_framecode), ::Method, ::Type) at ./none:0
[8] #prepare_call#38(::Bool, ::typeof(JuliaInterpreter.prepare_call), ::Any, ::Array{Any,1}) at /Users/UserName/.julia/packages/JuliaInterpreter/RmxVj/src/construct.jl:261
[9] #prepare_call at ./none:0 [inlined]
[10] #get_call_framecode#59(::Bool, ::typeof(JuliaInterpreter.get_call_framecode), ::Array{Any,1}, ::JuliaInterpreter.FrameCode, ::Int64) at /Users/UserName/.julia/packages/JuliaInterpreter/RmxVj/src/localmethtable.jl:63
[11] #get_call_framecode at ./none:0 [inlined]
[12] #evaluate_call_recurse!#64(::Bool, ::typeof(JuliaInterpreter.evaluate_call_recurse!), ::Any, ::JuliaInterpreter.Frame, ::Expr) at /Users/UserName/.julia/packages/JuliaInterpreter/RmxVj/src/interpret.jl:225
[13] evaluate_call_recurse! at /Users/UserName/.julia/packages/JuliaInterpreter/RmxVj/src/interpret.jl:202 [inlined]
[14] eval_rhs(::Any, ::JuliaInterpreter.Frame, ::Expr) at /Users/UserName/.julia/packages/JuliaInterpreter/RmxVj/src/interpret.jl:387
[15] step_expr!(::Any, ::JuliaInterpreter.Frame, ::Any, ::Bool) at /Users/UserName/.julia/packages/JuliaInterpreter/RmxVj/src/interpret.jl:443
[16] step_expr!(::Any, ::JuliaInterpreter.Frame, ::Bool) at /Users/UserName/.julia/packages/JuliaInterpreter/RmxVj/src/interpret.jl:577
[17] finish!(::Any, ::JuliaInterpreter.Frame, ::Bool) at /Users/UserName/.julia/packages/JuliaInterpreter/RmxVj/src/commands.jl:14
[18] finish_and_return! at /Users/UserName/.julia/packages/JuliaInterpreter/RmxVj/src/commands.jl:29 [inlined]
[19] #evaluate_call_recurse!#64(::Bool, ::typeof(JuliaInterpreter.evaluate_call_recurse!), ::Any, ::JuliaInterpreter.Frame, ::Expr) at /Users/UserName/.julia/packages/JuliaInterpreter/RmxVj/src/interpret.jl:240
[20] evaluate_call_recurse! at /Users/UserName/.julia/packages/JuliaInterpreter/RmxVj/src/interpret.jl:202 [inlined]
[21] eval_rhs(::Any, ::JuliaInterpreter.Frame, ::Expr) at /Users/UserName/.julia/packages/JuliaInterpreter/RmxVj/src/interpret.jl:387
[22] step_expr!(::Any, ::JuliaInterpreter.Frame, ::Any, ::Bool) at /Users/UserName/.julia/packages/JuliaInterpreter/RmxVj/src/interpret.jl:443
[23] step_expr! at /Users/UserName/.julia/packages/JuliaInterpreter/RmxVj/src/interpret.jl:577 [inlined]
[24] next_until!(::Any, ::Any, ::JuliaInterpreter.Frame, ::Bool) at /Users/UserName/.julia/packages/JuliaInterpreter/RmxVj/src/commands.jl:91
[25] _next_line!(::Any, ::JuliaInterpreter.Frame, ::Bool, ::Int64, ::String) at /Users/UserName/.julia/packages/JuliaInterpreter/RmxVj/src/commands.jl:180
[26] next_line!(::Any, ::JuliaInterpreter.Frame, ::Bool) at /Users/UserName/.julia/packages/JuliaInterpreter/RmxVj/src/commands.jl:175
[27] #debug_command#87(::Nothing, ::typeof(JuliaInterpreter.debug_command), ::Any, ::JuliaInterpreter.Frame, ::Symbol, ::Bool) at /Users/UserName/.julia/packages/JuliaInterpreter/RmxVj/src/commands.jl:433
[28] debug_command(::Any, ::JuliaInterpreter.Frame, ::Symbol, ::Bool) at /Users/UserName/.julia/packages/JuliaInterpreter/RmxVj/src/commands.jl:415
[29] (::Atom.JunoDebugger.var"#54#56"{Bool,Bool,Bool})() at /Users/UserName/.julia/packages/Atom/isnka/src/debugger/stepper.jl:193
[30] evalscope(::Atom.JunoDebugger.var"#54#56"{Bool,Bool,Bool}) at /Users/UserName/.julia/packages/Atom/isnka/src/debugger/stepper.jl:386
[31] #startdebugging#53(::Bool, ::Bool, ::typeof(Atom.JunoDebugger.startdebugging), ::JuliaInterpreter.Frame, ::Bool) at /Users/UserName/.julia/packages/Atom/isnka/src/debugger/stepper.jl:151
[32] #startdebugging at ./none:0 [inlined]
[33] (::Base.var"#inner#2"{Base.Iterators.Pairs{Symbol,Bool,Tuple{Symbol,Symbol},NamedTuple{(:istoplevel, :toggle_ui),Tuple{Bool,Bool}}},typeof(Atom.JunoDebugger.startdebugging),Tuple{JuliaInterpreter.Frame,Bool}})() at ./essentials.jl:712
[34] #invokelatest#1(::Base.Iterators.Pairs{Symbol,Bool,Tuple{Symbol,Symbol},NamedTuple{(:istoplevel, :toggle_ui),Tuple{Bool,Bool}}}, ::typeof(Base.invokelatest), ::Any, ::Any, ::Vararg{Any,N} where N) at ./essentials.jl:713
[35] (::Base.var"#kw##invokelatest")(::NamedTuple{(:istoplevel, :toggle_ui),Tuple{Bool,Bool}}, ::typeof(Base.invokelatest), ::Function, ::JuliaInterpreter.Frame, ::Vararg{Any,N} where N) at ./none:0
[36] (::Atom.JunoDebugger.var"#48#51"{String,String,Bool,Int64})() at /Users/UserName/.julia/packages/Atom/isnka/src/debugger/stepper.jl:113
[37] hideprompt(::Atom.JunoDebugger.var"#48#51"{String,String,Bool,Int64}) at /Users/UserName/.julia/packages/Atom/isnka/src/repl.jl:127
[38] #47 at /Users/UserName/.julia/packages/Atom/isnka/src/debugger/stepper.jl:84 [inlined]
[39] task_local_storage(::Atom.JunoDebugger.var"#47#50"{String,String,Bool,Int64}, ::Symbol, ::String) at ./task.jl:226
[40] debug_file(::String, ::String, ::String, ::Bool, ::Int64) at /Users/UserName/.julia/packages/Atom/isnka/src/debugger/stepper.jl:83
[41] debug_file(::String, ::String, ::String, ::Bool) at /Users/UserName/.julia/packages/Atom/isnka/src/debugger/stepper.jl:81
[42] handlemsg(::Dict{String,Any}, ::String, ::Vararg{Any,N} where N) at /Users/UserName/.julia/packages/Atom/isnka/src/comm.jl:169
[43] (::Atom.var"#31#33"{Array{Any,1}})() at ./task.jl:333
Metadata
Metadata
Assignees
Labels
No labels