# POMDPs.jl action(mdp,initial\_state) doesnt return expected/correct action

**URL:** <https://discourse.julialang.org/t/pomdps-jl-action-mdp-initial-state-doesnt-return-expected-correct-action/119838>\
**Category:** New to Julia\
**Tags:** question, package\
**Created:** [September 24, 2024, 11:44pm UTC](https://discourse.julialang.org/t/pomdps-jl-action-mdp-initial-state-doesnt-return-expected-correct-action/119838 "2024-09-24T23:44:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MindFullOfLettuce](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mindfulloflettuce/32/212189_2.png) [@MindFullOfLettuce](https://discourse.julialang.org/u/MindFullOfLettuce)\
**Post date:** [September 24, 2024, 11:44pm UTC](https://discourse.julialang.org/t/pomdps-jl-action-mdp-initial-state-doesnt-return-expected-correct-action/119838/1 "2024-09-24T23:44:20Z")

</div>

Hi,  
I’m doing: (s is initial state)

> sim = RolloutSimulator()  
> r = simulate(sim, mdp, policy,s)

but the selected actions during simulate aren’t correct and don’t go by the POMDPs.actions functions that I implemented for my MDP. So simulate goes into an infinite loop unable to get to a terminal state. (Tried it with strepthrough too)  
I’m unsure but it looks like simulate doesn’t use POMDPs.actions or actionsindex. As calling actions manually gives the correct action.

Should I just implement action() myself?

---

<div class="post-metadata">

**Author:** ![MindFullOfLettuce](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mindfulloflettuce/32/212189_2.png) [@MindFullOfLettuce](https://discourse.julialang.org/u/MindFullOfLettuce)\
**Post date:** [September 25, 2024, 12:10am UTC](https://discourse.julialang.org/t/pomdps-jl-action-mdp-initial-state-doesnt-return-expected-correct-action/119838/2 "2024-09-25T00:10:04Z")

</div>

It seems like MCTSSolver works. I’m unsure why ValueIterationSolver didn’t work.
