"OpenAIGym" (Reinforcement Learning Environments)
"OpenAIGym" provides an interface to the Python OpenAI Gym reinforcement learning environments package.
To use "OpenAIGym", the OpenAI Gym Python package must be installed.
The OpenAI Gym Python package is only officially supported on Linux and macOS platforms. Additionally, several different families of environments are available. Examples on this page use the "Atari" family of environments. Depending on the host system details, this family can be installed from the command line using one of the following (additional detailed installation instructions are available here):
$ pip install "gym[atari]"
$ pip3 install "gym[atari]"
$ pip install gym atari-py
ExternalEvaluate is used to interface with this Python package. It is up to the user to ensure that ExternalEvaluate is set up with a Python environment with Gym installed. A simple test to ensure that Gym is correctly set up is to run the following:
ExternalEvaluate["Python", "import gym"]
Examples
Basic Examples (2)
Open the "Atlantis-v0" Atari environment:
In this case, the "ObservedState" is an array of pixel values. Visualize this as an image:
Taking an action usually modifies the "ObservedState":
Reset the environment to an initial state. The initial "ObservedState" is returned:
Open the "Breakout-v0" environment: