Error with obs_weight
Closed this issue · 2 comments
Please check this file for how I try to create and then use POMCPOW - https://github.com/Shushman/CS238-Project/blob/master/juliaCode/RunPomdp.jl#L16
I get the following stacktrace which has to do with obs_weight
:
ERROR: LoadError: MethodError: no method matching obs_weight(::UAVpomdp, ::State, ::Int64, ::State, ::Observation)
Closest candidates are:
obs_weight(::Any, ::Any, ::Any, ::Any, ::Any) at /Users/shushmanchoudhury/.julia/v0.6/ParticleFilters/src/obs_weight.jl:2
obs_weight(::Any, ::Any, ::Any, ::Any) at /Users/shushmanchoudhury/.julia/v0.6/ParticleFilters/src/obs_weight.jl:12
obs_weight(::Any, ::Any, ::Any) at /Users/shushmanchoudhury/.julia/v0.6/ParticleFilters/src/obs_weight.jl:22
Stacktrace:
[1] simulate(::POMCPOW.POMCPOWPlanner{UAVpomdp,POMCPOW.POWNodeFilter,POMCPOW.MaxUCB,MCTS.RandomActionGenerator{MersenneTwister},BasicPOMCP.SolvedPORollout{POMDPToolbox.RandomPolicy{MersenneTwister,UAVpomdp,POMDPToolbox.VoidUpdater},POMDPToolbox.VoidUpdater,MersenneTwister},Int64,Float64,POMCPOW.POMCPOWSolver}, ::POMCPOW.POWTreeObsNode{POMCPOW.POWNodeBelief{State,Int64,Observation,UAVpomdp},Int64,Observation,BeliefState}, ::State, ::Int64) at /Users/shushmanchoudhury/.julia/v0.6/POMCPOW/src/solver2.jl:68
[2] search(::POMCPOW.POMCPOWPlanner{UAVpomdp,POMCPOW.POWNodeFilter,POMCPOW.MaxUCB,MCTS.RandomActionGenerator{MersenneTwister},BasicPOMCP.SolvedPORollout{POMDPToolbox.RandomPolicy{MersenneTwister,UAVpomdp,POMDPToolbox.VoidUpdater},POMDPToolbox.VoidUpdater,MersenneTwister},Int64,Float64,POMCPOW.POMCPOWSolver}, ::POMCPOW.POMCPOWTree{POMCPOW.POWNodeBelief{State,Int64,Observation,UAVpomdp},Int64,Observation,BeliefState}) at /Users/shushmanchoudhury/.julia/v0.6/POMCPOW/src/planner2.jl:50
[3] action(::POMCPOW.POMCPOWPlanner{UAVpomdp,POMCPOW.POWNodeFilter,POMCPOW.MaxUCB,MCTS.RandomActionGenerator{MersenneTwister},BasicPOMCP.SolvedPORollout{POMDPToolbox.RandomPolicy{MersenneTwister,UAVpomdp,POMDPToolbox.VoidUpdater},POMDPToolbox.VoidUpdater,MersenneTwister},Int64,Float64,POMCPOW.POMCPOWSolver}, ::BeliefState) at /Users/shushmanchoudhury/.julia/v0.6/POMCPOW/src/planner2.jl:36
[4] macro expansion at /Users/shushmanchoudhury/Documents/Courses/DMU-autumn17/CS238-Project/juliaCode/RunPomdp.jl:35 [inlined]
[5] anonymous at ./<missing>:?
[6] include_from_node1(::String) at ./loading.jl:569
[7] include(::String) at ./sysimg.jl:14
[8] process_options(::Base.JLOptions) at ./client.jl:305
[9] _start() at ./client.jl:371
while loading /Users/shushmanchoudhury/Documents/Courses/DMU-autumn17/CS238-Project/juliaCode/RunPomdp.jl, in expression starting on line 32
Please see here (https://github.com/Shushman/CS238-Project/blob/master/juliaCode/UAVpomdp.jl#L191) for where we have implemented obs_weight
. Not sure what the problem is.
Hi Shushman,
The obs_weight function is not officially part of the POMDPs.jl interface; It is a shortcut for pdf(observation(...), ...)
borrowed from ParticleFilters.jl. To implement a new method for it, you need to explicitly import it from ParticleFilters, i.e. put
import ParticleFilters: obs_weight
at the top of UAVpomdp.jl or change line 191 to be
function ParticleFilters.obs_weight(p::UAVpomdp, a::Int, sp::State, o::Observation)
Let me know if that fixes it.
Good luck!
Thanks! That did indeed fix it.