Skip to content

Can states be mutable? #527

Nov 17, 2023 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

You're correct! Mutating the state or mdp object will break most solvers. Philosophically, POMDPs.jl assumes that states and problems are immutable. This has significant performance and clarity advantages.

You can still implement your desired behavior with an immutable state - you just have to make sure to decide if the problem is done within transition. If the reward function is not too expensive (and it usually isn't compared to other things involved in (PO)MDP solving), you could just do this:

function transition(m, s, a)
    ... # generate new state here using (s, a)
    done = reward(m, s, a) != 0
    return Deterministic(MyState(..., done))
end

(Also transition should return a distr…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@zsunberg
Comment options

@kpa28-git
Comment options

Answer selected by kpa28-git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants