JuliaPOMDP / POMDPs.jl

MDPs and POMDPs in Julia - An interface for defining, solving, and simulating fully and partially observable Markov decision processes on discrete and continuous spaces.
http://juliapomdp.github.io/POMDPs.jl/latest/
Other
662 stars 100 forks source link

Any recommendation to fix this? #388

Closed Etwari3 closed 2 years ago

Etwari3 commented 2 years ago

MethodError: no method matching pdf(::Array{Float64, 3}, ::String)

zsunberg commented 2 years ago

This means that the solver is trying to evaluate the probability of a particular string in an array of floats.

This error is likely caused by returning an array of Floats instead of a Distribution object in transition, observation or initialstate. Judging by the error, it seems like your states are Strings. So instead of something like

return [0.1, 0.2, 0.7]

you should use a distribution object such as a 'SparseCat'

return SparseCat(["a", "b", "c"], [0.1, 0.2, 0.7])

in your transition, observation, and initialstate functions.

Side note: for future questions, it may be more helpful to post in the discussions section of POMDPs.jl https://github.com/JuliaPOMDP/POMDPs.jl/discussions rather than as an issue in this particular solver.