Determine the set of actions available in a state.
Arguments
- model
a MDP object.
- state
a character vector specifying the states.
- neg_inf_reward
logical; consider an action that produced
-Infreward to all end states unavailable?- stay_in_place
logical; consider an action that results in the same state with a probability of 1 as unavailable. Note that this means that absorbing states have no available action!
Details
Unavailable actions are modeled as actions that have an immediate
reward of -Inf in the reward function. For a maze, also actions that
do not change the state can be considered unavailable.
Examples
data(DynaMaze)
gw_plot(DynaMaze)
# The following actions are always available:
DynaMaze$actions
#> [1] "up" "right" "down" "left"
# only right and down is unavailable for s(1,1) because they
# make the agent stay in place.
available_actions(DynaMaze, state = "s(1,1)", stay_in_place = TRUE)
#> up right down left
#> s(1,1) FALSE TRUE TRUE FALSE
# An action that leaves the grid currently is allowed but does not do
# anything.
act(DynaMaze, "s(1,1)", "up")
#> $reward
#> [1] -1
#>
#> $state_prime
#> [1] s(1,1)
#> 47 Levels: s(1,1) s(2,1) s(3,1) s(4,1) s(5,1) s(6,1) s(1,2) s(2,2) ... s(6,9)
#>