powered by
Reinforcement learning environment from OpenAI Gym.
[character(1)] Name of gym environment, e.g. "CartPole-v0".
character(1)
"CartPole-v0"
[any] Arguments passed on to makeEnvironment.
any
makeEnvironment("gym", gym.name, ...)
For installation of the python package gym see https://github.com/openai/gym#installation. Then install the R package reticulate.
gym
reticulate
$close() Close visualization window.
$close()
$step(action) Take action in environment. Returns a list with state, reward, done.
$step(action)
state
reward
done
$reset() Resets the done flag of the environment and returns an initial state. Useful when starting a new episode.
$reset()
$visualize() Visualizes the environment (if there is a visualization function).
$visualize()
For available gym environments take a look at https://gym.openai.com/envs.
# NOT RUN { # Create an OpenAI Gym environment. # Make sure you have Python, gym and reticulate installed. env = makeEnvironment("gym", gym.name = "MountainCar-v0") env$reset() env$close() # }
Run the code above in your browser using DataLab