-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default implementation of convert_s for instances of QuickPOMDPs.QuickMDP #41
Comments
Thanks for posting! The short answer is that something like what you are suggesting has already been done: https://github.com/JuliaPOMDP/POMDPs.jl/blob/d837f1650c80787ce4ca6a5230813698b9eac9a6/src/pomdp.jl#L153-L159 The reason that the implementation already in POMDPs.jl linked above does not work for the JuliaAcademy MDPs tutorial is that So, the best fix would be to make the state in the MDP example a vector. Two ways to do this are:
or just using the static vector itself as the state type:
and deleting I am not sure how to update the julia academy code, but such an update would be extremely helpful! The reason that we do not use the |
Thanks, adding that instance of StaticArrays.FieldVector worked! That's an easy tweak to make. It also fixed another bug I was seeing, so maybe that was a consequence of my fix being a vector of states rather than a vectorized state. There still seems to be at least one bug in my code preventing a successful call to |
Whoops, forgot to close the issue. Doing that now. |
This is a change that should not affect the behavior of this notebook directly. It makes the notebook's MDP easier to use with other libraries including Crux.jl. See JuliaPOMDP/QuickPOMDPs.jl#41 (comment) for some context. In short, this change results in an automatic definition for POMDPs.convert_s, which Crux relies on.
Note: not sure if the following is already covered by #2
I have been experimenting with porting a gridworld-style MDP from python to Julia using https://github.com/JuliaAcademy/Decision-Making-Under-Uncertainty/blob/master/notebooks/1-MDPs.jl as a starting point. In order to run Crux.jl's deep Q-learning solver on a MDP, that MDP needs to have an implementation of
POMDPs.convert_s
.Based on JuliaPOMDP/POMDPs.jl#452, I provided the following implementation to get things working:
I'm not too familiar with Julia yet, but it seems that with a little modification of the type requirements in the function above, this could become a universal implementation of convert_s for any MDP built using the QuickMDP constructor. It's more or less the same as
return
in Haskell, for example.Does this seem reasonable? It's certainly not hard to provide the implementation manually on a case-by-case basis, but a default implementation could save a lot of troubleshooting time for Julia beginners like myself or the OP in that issue linked above.
The text was updated successfully, but these errors were encountered: