2022-09-13 20:27:34 +01:00
---
hide-toc: true
firstpage:
lastpage:
---
2022-10-12 15:58:01 +01:00
# Gymnasium is a standard API for reinforcement learning, and a diverse collection of reference environments
2022-09-13 20:27:34 +01:00
```{figure} _static/videos/box2d/lunar_lander_continuous.gif
:alt: Lunar Lander
:width: 500
```
2022-10-16 14:54:03 +01:00
**Gymnasium is a maintained fork of OpenAI’ s Gym library. The Gymnasium interface is simple, pythonic, and capable of representing general RL problems, and has a [compatibility wrapper](content/gym_compatibility
) for old Gym environments:**
2022-09-13 20:27:34 +01:00
```{code-block} python
2022-09-19 21:14:09 +01:00
import gymnasium as gym
env = gym.make("LunarLander-v2", render_mode="human")
2022-09-13 20:27:34 +01:00
observation, info = env.reset(seed=42)
for _ in range(1000):
2022-10-29 13:19:09 +01:00
action = env.action_space.sample() # this is where you would insert your policy
2022-09-13 20:27:34 +01:00
observation, reward, terminated, truncated, info = env.step(action)
if terminated or truncated:
observation, info = env.reset()
env.close()
2022-10-03 19:01:14 +01:00
```
2022-09-13 20:27:34 +01:00
```{toctree}
:hidden:
:caption: Introduction
content/basic_usage
2022-10-12 15:58:28 +01:00
content/gym_compatibility
2022-10-24 22:44:08 +01:00
content/migration-guide
2022-09-13 20:27:34 +01:00
```
```{toctree}
:hidden:
:caption: API
2022-10-12 15:58:01 +01:00
api/env
api/registry
2022-09-13 20:27:34 +01:00
api/spaces
api/wrappers
api/vector
api/utils
2022-11-29 23:37:53 +00:00
api/experimental
2022-09-13 20:27:34 +01:00
```
```{toctree}
:hidden:
:caption: Environments
2022-10-03 19:01:14 +01:00
environments/classic_control
environments/box2d
2022-10-12 15:58:01 +01:00
environments/toy_text
environments/mujoco
environments/atari
2022-10-03 19:01:14 +01:00
environments/third_party_environments
2022-09-13 20:27:34 +01:00
```
```{toctree}
:hidden:
2022-10-16 14:54:03 +01:00
:glob:
2022-09-13 20:27:34 +01:00
:caption: Tutorials
2023-01-11 14:00:51 -06:00
tutorials/**/index
2022-09-13 20:27:34 +01:00
```
```{toctree}
:hidden:
:caption: Development
2022-09-16 14:00:12 +01:00
Github < https: / / github . com / Farama-Foundation / Gymnasium >
2023-01-11 10:15:29 -06:00
release_notes/index
2022-10-25 11:38:43 +01:00
Contribute to the Docs < https: / / github . com / Farama-Foundation / Gymnasium / blob / main / docs / README . md >
2022-09-13 20:27:34 +01:00
```