| MdpEnvironment | R Documentation |
Markov Decision Process environment.
transitions |
[ |
rewards |
[ |
initial.state |
[ |
... |
[ |
makeEnvironment("MDP", transitions, rewards, initial.state, ...)
$step(action)
Take action in environment.
Returns a list with state, reward, done.
$reset()
Resets the done flag of the environment and returns an initial state.
Useful when starting a new episode.
$visualize()
Visualizes the environment (if there is a visualization function).
# Create a Markov Decision Process.
P = array(0, c(2, 2, 2))
P[, , 1] = matrix(c(0.5, 0.5, 0, 1), 2, 2, byrow = TRUE)
P[, , 2] = matrix(c(0, 1, 0, 1), 2, 2, byrow = TRUE)
R = matrix(c(5, 10, -1, 2), 2, 2, byrow = TRUE)
env = makeEnvironment("mdp", transitions = P, rewards = R)
env$reset()
env$step(1L)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.