Files
Gymnasium/docs/index.md

92 lines
2.3 KiB
Markdown
Raw Normal View History

2022-09-13 20:27:34 +01:00
---
hide-toc: true
firstpage:
lastpage:
---
<center>
<h1>
Gymnasium is a standard API for reinforcement learning, and a diverse collection of reference environments.
</h1>
</center>
2022-09-13 20:27:34 +01:00
<center>
<p>Note: The video includes clips with trained agents from Stable Baselines3. (<a href="https://huggingface.co/sb3">Link</a>)</p>
<video autoplay loop muted inline width="450" src="_static/videos/environments-demo.mp4" type="video/mp4"></video>
</center>
2022-09-13 20:27:34 +01:00
Gymnasium is a maintained fork of OpenAIs Gym library. It provides a user-friendly, pythonic interface for creating and interacting with reinforcement learning environments. With Gymnasium, you can access a diverse collection of environments, as well as represent your own custom RL environments. If you require an environment that is only available in the old Gym, you can use the [compatibility wrapper](content/gym_compatibility).
2022-09-13 20:27:34 +01:00
Here is a minimal code example to run an environment:
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("CartPole-v1", render_mode="human")
observation, info = env.reset(seed=42) # get the first observation
for step in range(1000):
# here you can use your policy to get an action based on the observation
action = env.action_space.sample()
# execute the action in the environment
observation, reward, terminated, truncated, info = env.step(action)
if terminated or truncated:
observation, info = env.reset()
2022-09-13 20:27:34 +01:00
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
content/migration-guide
2022-09-13 20:27:34 +01:00
```
```{toctree}
:hidden:
:caption: API
api/env
api/registry
2022-09-13 20:27:34 +01:00
api/spaces
api/wrappers
api/vector
api/utils
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
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:
:glob:
2022-09-13 20:27:34 +01:00
:caption: Tutorials
2023-01-11 14:00:51 -06:00
tutorials/**/index
2023-02-01 22:30:49 +00:00
Comet Tutorial <https://www.comet.com/docs/v2/integrations/ml-frameworks/gymnasium/?utm_source=gymnasium&utm_medium=partner&utm_campaign=partner_gymnasium_2023&utm_content=docs_gymnasium>
2022-09-13 20:27:34 +01:00
```
```{toctree}
:hidden:
:caption: Development
Github <https://github.com/Farama-Foundation/Gymnasium>
gymnasium_release_notes/index
gym_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
```