value does not work if called before action
zsunberg opened this issue · 0 comments
zsunberg commented
This happens because value
checks if the tree is not nothing in
Line 208 in 47b8681
julia> sol3 = solve(s3, m)
julia> value(sol3, states[4])
ERROR: State 0.06060606060606082 not present in MCTS tree.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:33
[2] value(tr::MCTS.MCTSTree{Float64, Float64}, s::Float64)
@ MCTS ~/.julia/dev/MCTS/src/vanilla.jl:217
[3] value(planner::MCTSPlanner{QuickMDP{UUID("20287054-e7ba-4231-98f4-917124d65b0b"), Float64, Float64, NamedTuple{(:stateindex, :isterminal, :actionindex, :transition, :reward, :states, :actions, :discount), Tuple{Dict{Float64, Int64}, Bool, Dict{Float64, Int64}, var"#12#14", var"#13#15", StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}, typeof(valid_actions), Float64}}}, Float64, Float64, MCTS.SolvedRolloutEstimator{POMDPPolicies.RandomPolicy{Random._GLOBAL_RNG, QuickMDP{UUID("20287054-e7ba-4231-98f4-917124d65b0b"), Float64, Float64, NamedTuple{(:stateindex, :isterminal, :actionindex, :transition, :reward, :states, :actions, :discount), Tuple{Dict{Float64, Int64}, Bool, Dict{Float64, Int64}, var"#12#14", var"#13#15", StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}, typeof(valid_actions), Float64}}}, BeliefUpdaters.NothingUpdater}, Random._GLOBAL_RNG}, Random._GLOBAL_RNG}, s::Float64)
@ MCTS ~/.julia/dev/MCTS/src/vanilla.jl:211
[4] top-level scope
@ REPL[61]:1