diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ffe5ea193..9388e767b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,4 +14,4 @@ jobs: --build-arg PYTHON_VERSION=${{ matrix.python-version }} \ --tag gym-docker . - name: Run tests - run: docker run gym-docker pytest + run: docker run gymnasium-docker pytest diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1359be7a9..60f5df1c2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,7 +15,7 @@ repos: hooks: - id: flake8 args: - - '--per-file-ignores=*/__init__.py:F401 gym/envs/registration.py:E704' + - '--per-file-ignores=*/__init__.py:F401 gymnasium/envs/registration.py:E704' - --ignore=E203,W503,E741 - --max-complexity=30 - --max-line-length=456 @@ -30,7 +30,7 @@ repos: rev: 6.1.1 # pick a git hash / tag to point to hooks: - id: pydocstyle - exclude: ^(gym/version.py)|(gym/envs/)|(tests/) + exclude: ^(gymnasium/version.py)|(gymnasium/envs/)|(tests/) args: - --source - --explain diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 640a82f61..1b7161052 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,21 +1,15 @@ -# Gym Contribution Guidelines +# Gymnasium Contribution Guidelines At this time we are currently accepting the current forms of contributions: - Bug reports (keep in mind that changing environment behavior should be minimized as that requires releasing a new version of the environment and makes results hard to compare across versions) - Pull requests for bug fixes - Documentation improvements +- Features Notably, we are not accepting these forms of contributions: - New environments -- New features - -This may change in the future. -If you wish to make a Gym environment, follow the instructions in [Creating Environments](https://github.com/openai/gym/blob/master/docs/creating_environments.md). When your environment works, you can make a PR to add it to the bottom of the [List of Environments](https://github.com/openai/gym/blob/master/docs/third_party_environments.md). - - -Edit July 27, 2021: Please see https://github.com/openai/gym/issues/2259 for new contributing standards # Development This section contains technical instructions & hints for the contributors. diff --git a/README.md b/README.md index 33e591692..116b39635 100644 --- a/README.md +++ b/README.md @@ -25,13 +25,13 @@ We support Python 3.7, 3.8, 3.9 and 3.10 on Linux and macOS. We will accept PRs The Gym API's API models environments as simple Python `env` classes. Creating environment instances and interacting with them is very simple- here's an example using the "CartPole-v1" environment: ```python -import gym +import gymnasium as gym env = gym.make("CartPole-v1") observation, info = env.reset(seed=42) for _ in range(1000): action = env.action_space.sample() - observation, reward, terminated, truncarted, info = env.step(action) + observation, reward, terminated, truncated, info = env.step(action) if terminated or truncated: observation, info = env.reset() @@ -43,7 +43,7 @@ env.close() * [Stable Baselines 3](https://github.com/DLR-RM/stable-baselines3) is a learning library based on the Gym API. It is designed to cater to complete beginners in the field who want to start learning things quickly. * [RL Baselines3 Zoo](https://github.com/DLR-RM/rl-baselines3-zoo) builds upon SB3, containing optimal hyperparameters for Gym environments as well as code to easily find new ones. * [Tianshou](https://github.com/thu-ml/tianshou) is a learning library that's geared towards very experienced users and is design to allow for ease in complex algorithm modifications. -* [RLlib](https://docs.ray.io/en/latest/rllib/index.html) is a learning library that allows for distributed training and inferencing and supports an extraordinarily large number of features throughout the reinforcement learning space. +* [RLlib](https://docs.ray.io/en/latest/rllib/index.html) is a learning library that allows for distributed training and inference and supports an extraordinarily large number of features throughout the reinforcement learning space. * [PettingZoo](https://github.com/Farama-Foundation/PettingZoo) is like Gym, but for environments with multiple agents. ## Environment Versioning @@ -70,4 +70,4 @@ A whitepaper from when Gym just came out is available https://arxiv.org/pdf/1606 ## Release Notes -There used to be release notes for all the new Gym versions here. New release notes are being moved to [releases page](https://github.com/openai/gym/releases) on GitHub, like most other libraries do. Old notes can be viewed [here](https://github.com/openai/gym/blob/31be35ecd460f670f0c4b653a14c9996b7facc6c/README.rst). +There used to be release notes for all the new Gym versions here. New release notes are being moved to [releases page](https://github.com/Farama-Foundation/Gymnasium/releases) on GitHub, like most other libraries do. diff --git a/gym/envs/box2d/__init__.py b/gym/envs/box2d/__init__.py deleted file mode 100644 index e702010b6..000000000 --- a/gym/envs/box2d/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from gym.envs.box2d.bipedal_walker import BipedalWalker, BipedalWalkerHardcore -from gym.envs.box2d.car_racing import CarRacing -from gym.envs.box2d.lunar_lander import LunarLander, LunarLanderContinuous diff --git a/gym/envs/classic_control/__init__.py b/gym/envs/classic_control/__init__.py deleted file mode 100644 index 308185f39..000000000 --- a/gym/envs/classic_control/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -from gym.envs.classic_control.acrobot import AcrobotEnv -from gym.envs.classic_control.cartpole import CartPoleEnv -from gym.envs.classic_control.continuous_mountain_car import Continuous_MountainCarEnv -from gym.envs.classic_control.mountain_car import MountainCarEnv -from gym.envs.classic_control.pendulum import PendulumEnv diff --git a/gym/envs/mujoco/__init__.py b/gym/envs/mujoco/__init__.py deleted file mode 100644 index b31265ae5..000000000 --- a/gym/envs/mujoco/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -from gym.envs.mujoco.mujoco_env import MujocoEnv, MuJocoPyEnv # isort:skip -from gym.envs.mujoco.mujoco_rendering import ( # isort:skip - RenderContextOffscreen, - Viewer, -) - -# ^^^^^ so that user gets the correct error -# message if mujoco is not installed correctly -from gym.envs.mujoco.ant import AntEnv -from gym.envs.mujoco.half_cheetah import HalfCheetahEnv -from gym.envs.mujoco.hopper import HopperEnv -from gym.envs.mujoco.humanoid import HumanoidEnv -from gym.envs.mujoco.humanoidstandup import HumanoidStandupEnv -from gym.envs.mujoco.inverted_double_pendulum import InvertedDoublePendulumEnv -from gym.envs.mujoco.inverted_pendulum import InvertedPendulumEnv -from gym.envs.mujoco.pusher import PusherEnv -from gym.envs.mujoco.reacher import ReacherEnv -from gym.envs.mujoco.swimmer import SwimmerEnv -from gym.envs.mujoco.walker2d import Walker2dEnv diff --git a/gym/envs/toy_text/__init__.py b/gym/envs/toy_text/__init__.py deleted file mode 100644 index 36e120795..000000000 --- a/gym/envs/toy_text/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -from gym.envs.toy_text.blackjack import BlackjackEnv -from gym.envs.toy_text.cliffwalking import CliffWalkingEnv -from gym.envs.toy_text.frozen_lake import FrozenLakeEnv -from gym.envs.toy_text.taxi import TaxiEnv diff --git a/gym/vector/utils/__init__.py b/gym/vector/utils/__init__.py deleted file mode 100644 index c03f85335..000000000 --- a/gym/vector/utils/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -"""Module for gym vector utils.""" -from gym.vector.utils.misc import CloudpickleWrapper, clear_mpi_env_vars -from gym.vector.utils.numpy_utils import concatenate, create_empty_array -from gym.vector.utils.shared_memory import ( - create_shared_memory, - read_from_shared_memory, - write_to_shared_memory, -) -from gym.vector.utils.spaces import _BaseGymSpaces # pyright: reportPrivateUsage=false -from gym.vector.utils.spaces import BaseGymSpaces, batch_space, iterate - -__all__ = [ - "CloudpickleWrapper", - "clear_mpi_env_vars", - "concatenate", - "create_empty_array", - "create_shared_memory", - "read_from_shared_memory", - "write_to_shared_memory", - "BaseGymSpaces", - "batch_space", - "iterate", -] diff --git a/gym/wrappers/__init__.py b/gym/wrappers/__init__.py deleted file mode 100644 index fdf2de530..000000000 --- a/gym/wrappers/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -"""Module of wrapper classes.""" -from gym import error -from gym.wrappers.atari_preprocessing import AtariPreprocessing -from gym.wrappers.autoreset import AutoResetWrapper -from gym.wrappers.clip_action import ClipAction -from gym.wrappers.filter_observation import FilterObservation -from gym.wrappers.flatten_observation import FlattenObservation -from gym.wrappers.frame_stack import FrameStack, LazyFrames -from gym.wrappers.gray_scale_observation import GrayScaleObservation -from gym.wrappers.human_rendering import HumanRendering -from gym.wrappers.normalize import NormalizeObservation, NormalizeReward -from gym.wrappers.order_enforcing import OrderEnforcing -from gym.wrappers.record_episode_statistics import RecordEpisodeStatistics -from gym.wrappers.record_video import RecordVideo, capped_cubic_video_schedule -from gym.wrappers.render_collection import RenderCollection -from gym.wrappers.rescale_action import RescaleAction -from gym.wrappers.resize_observation import ResizeObservation -from gym.wrappers.step_api_compatibility import StepAPICompatibility -from gym.wrappers.time_aware_observation import TimeAwareObservation -from gym.wrappers.time_limit import TimeLimit -from gym.wrappers.transform_observation import TransformObservation -from gym.wrappers.transform_reward import TransformReward -from gym.wrappers.vector_list_info import VectorListInfo diff --git a/gym/__init__.py b/gymnasium/__init__.py similarity index 70% rename from gym/__init__.py rename to gymnasium/__init__.py index 185f064ff..14ee8ddf5 100644 --- a/gym/__init__.py +++ b/gymnasium/__init__.py @@ -1,21 +1,21 @@ -"""Root __init__ of the gym module setting the __all__ of gym modules.""" +"""Root __init__ of the gymnasium module setting the __all__ of gymnasium modules.""" # isort: skip_file -from gym import error -from gym.version import VERSION as __version__ +from gymnasium import error +from gymnasium.version import VERSION as __version__ -from gym.core import ( +from gymnasium.core import ( Env, Wrapper, ObservationWrapper, ActionWrapper, RewardWrapper, ) -from gym.spaces import Space -from gym.envs import make, spec, register -from gym import logger -from gym import vector -from gym import wrappers +from gymnasium.spaces import Space +from gymnasium.envs import make, spec, register +from gymnasium import logger +from gymnasium import vector +from gymnasium import wrappers import os import sys diff --git a/gym/core.py b/gymnasium/core.py similarity index 97% rename from gym/core.py rename to gymnasium/core.py index 96e5870ce..8ad9638c4 100644 --- a/gym/core.py +++ b/gymnasium/core.py @@ -15,12 +15,12 @@ import numpy as np -from gym import spaces -from gym.logger import warn -from gym.utils import seeding +from gymnasium import spaces +from gymnasium.logger import warn +from gymnasium.utils import seeding if TYPE_CHECKING: - from gym.envs.registration import EnvSpec + from gymnasium.envs.registration import EnvSpec if sys.version_info[0:2] == (3, 6): warn( @@ -51,7 +51,7 @@ class Env(Generic[ObsType, ActType]): - :attr:`action_space` - The Space object corresponding to valid actions - :attr:`observation_space` - The Space object corresponding to valid observations - :attr:`reward_range` - A tuple corresponding to the minimum and maximum possible rewards - - :attr:`spec` - An environment spec that contains the information used to initialise the environment from `gym.make` + - :attr:`spec` - An environment spec that contains the information used to initialise the environment from `gymnasium.make` - :attr:`metadata` - The metadata of the environment, i.e. render modes - :attr:`np_random` - The random number generator for the environment @@ -188,7 +188,7 @@ def unwrapped(self) -> "Env": """Returns the base non-wrapped environment. Returns: - Env: The base non-wrapped gym.Env instance + Env: The base non-wrapped gymnasium.Env instance """ return self @@ -362,7 +362,7 @@ class ObservationWrapper(Wrapper): ``observation["target_position"] - observation["agent_position"]``. For this, you could implement an observation wrapper like this:: - class RelativePosition(gym.ObservationWrapper): + class RelativePosition(gymnasium.ObservationWrapper): def __init__(self, env): super().__init__(env) self.observation_space = Box(shape=(2,), low=-np.inf, high=np.inf) @@ -402,7 +402,7 @@ class RewardWrapper(Wrapper): because it is intrinsic), we want to clip the reward to a range to gain some numerical stability. To do that, we could, for instance, implement the following wrapper:: - class ClipReward(gym.RewardWrapper): + class ClipReward(gymnasium.RewardWrapper): def __init__(self, env, min_reward, max_reward): super().__init__(env) self.min_reward = min_reward @@ -433,10 +433,10 @@ class ActionWrapper(Wrapper): In that case, you need to specify the new action space of the wrapper by setting :attr:`self.action_space` in the :meth:`__init__` method of your wrapper. - Let’s say you have an environment with action space of type :class:`gym.spaces.Box`, but you would only like + Let’s say you have an environment with action space of type :class:`gymnasium.spaces.Box`, but you would only like to use a finite subset of actions. Then, you might want to implement the following wrapper:: - class DiscreteActions(gym.ActionWrapper): + class DiscreteActions(gymnasium.ActionWrapper): def __init__(self, env, disc_to_cont): super().__init__(env) self.disc_to_cont = disc_to_cont @@ -446,7 +446,7 @@ def action(self, act): return self.disc_to_cont[act] if __name__ == "__main__": - env = gym.make("LunarLanderContinuous-v2") + env = gymnasium.make("LunarLanderContinuous-v2") wrapped_env = DiscreteActions(env, [np.array([1,0]), np.array([-1,0]), np.array([0,1]), np.array([0,-1])]) print(wrapped_env.action_space) #Discrete(4) diff --git a/gym/envs/__init__.py b/gymnasium/envs/__init__.py similarity index 58% rename from gym/envs/__init__.py rename to gymnasium/envs/__init__.py index cf7281027..a7b408718 100644 --- a/gym/envs/__init__.py +++ b/gymnasium/envs/__init__.py @@ -1,5 +1,5 @@ -from gym.envs.registration import load_env_plugins as _load_env_plugins -from gym.envs.registration import make, register, registry, spec +from gymnasium.envs.registration import load_env_plugins as _load_env_plugins +from gymnasium.envs.registration import make, register, registry, spec # Hook to load plugins from entry points _load_env_plugins() @@ -10,41 +10,41 @@ register( id="CartPole-v0", - entry_point="gym.envs.classic_control.cartpole:CartPoleEnv", + entry_point="gymnasium.envs.classic_control.cartpole:CartPoleEnv", max_episode_steps=200, reward_threshold=195.0, ) register( id="CartPole-v1", - entry_point="gym.envs.classic_control.cartpole:CartPoleEnv", + entry_point="gymnasium.envs.classic_control.cartpole:CartPoleEnv", max_episode_steps=500, reward_threshold=475.0, ) register( id="MountainCar-v0", - entry_point="gym.envs.classic_control.mountain_car:MountainCarEnv", + entry_point="gymnasium.envs.classic_control.mountain_car:MountainCarEnv", max_episode_steps=200, reward_threshold=-110.0, ) register( id="MountainCarContinuous-v0", - entry_point="gym.envs.classic_control.continuous_mountain_car:Continuous_MountainCarEnv", + entry_point="gymnasium.envs.classic_control.continuous_mountain_car:Continuous_MountainCarEnv", max_episode_steps=999, reward_threshold=90.0, ) register( id="Pendulum-v1", - entry_point="gym.envs.classic_control.pendulum:PendulumEnv", + entry_point="gymnasium.envs.classic_control.pendulum:PendulumEnv", max_episode_steps=200, ) register( id="Acrobot-v1", - entry_point="gym.envs.classic_control.acrobot:AcrobotEnv", + entry_point="gymnasium.envs.classic_control.acrobot:AcrobotEnv", reward_threshold=-100.0, max_episode_steps=500, ) @@ -54,14 +54,14 @@ register( id="LunarLander-v2", - entry_point="gym.envs.box2d.lunar_lander:LunarLander", + entry_point="gymnasium.envs.box2d.lunar_lander:LunarLander", max_episode_steps=1000, reward_threshold=200, ) register( id="LunarLanderContinuous-v2", - entry_point="gym.envs.box2d.lunar_lander:LunarLander", + entry_point="gymnasium.envs.box2d.lunar_lander:LunarLander", kwargs={"continuous": True}, max_episode_steps=1000, reward_threshold=200, @@ -69,14 +69,14 @@ register( id="BipedalWalker-v3", - entry_point="gym.envs.box2d.bipedal_walker:BipedalWalker", + entry_point="gymnasium.envs.box2d.bipedal_walker:BipedalWalker", max_episode_steps=1600, reward_threshold=300, ) register( id="BipedalWalkerHardcore-v3", - entry_point="gym.envs.box2d.bipedal_walker:BipedalWalker", + entry_point="gymnasium.envs.box2d.bipedal_walker:BipedalWalker", kwargs={"hardcore": True}, max_episode_steps=2000, reward_threshold=300, @@ -84,7 +84,7 @@ register( id="CarRacing-v2", - entry_point="gym.envs.box2d.car_racing:CarRacing", + entry_point="gymnasium.envs.box2d.car_racing:CarRacing", max_episode_steps=1000, reward_threshold=900, ) @@ -94,13 +94,13 @@ register( id="Blackjack-v1", - entry_point="gym.envs.toy_text.blackjack:BlackjackEnv", + entry_point="gymnasium.envs.toy_text.blackjack:BlackjackEnv", kwargs={"sab": True, "natural": False}, ) register( id="FrozenLake-v1", - entry_point="gym.envs.toy_text.frozen_lake:FrozenLakeEnv", + entry_point="gymnasium.envs.toy_text.frozen_lake:FrozenLakeEnv", kwargs={"map_name": "4x4"}, max_episode_steps=100, reward_threshold=0.70, # optimum = 0.74 @@ -108,7 +108,7 @@ register( id="FrozenLake8x8-v1", - entry_point="gym.envs.toy_text.frozen_lake:FrozenLakeEnv", + entry_point="gymnasium.envs.toy_text.frozen_lake:FrozenLakeEnv", kwargs={"map_name": "8x8"}, max_episode_steps=200, reward_threshold=0.85, # optimum = 0.91 @@ -116,12 +116,12 @@ register( id="CliffWalking-v0", - entry_point="gym.envs.toy_text.cliffwalking:CliffWalkingEnv", + entry_point="gymnasium.envs.toy_text.cliffwalking:CliffWalkingEnv", ) register( id="Taxi-v3", - entry_point="gym.envs.toy_text.taxi:TaxiEnv", + entry_point="gymnasium.envs.toy_text.taxi:TaxiEnv", reward_threshold=8, # optimum = 8.46 max_episode_steps=200, ) @@ -133,119 +133,119 @@ register( id="Reacher-v2", - entry_point="gym.envs.mujoco:ReacherEnv", + entry_point="gymnasium.envs.mujoco:ReacherEnv", max_episode_steps=50, reward_threshold=-3.75, ) register( id="Reacher-v4", - entry_point="gym.envs.mujoco.reacher_v4:ReacherEnv", + entry_point="gymnasium.envs.mujoco.reacher_v4:ReacherEnv", max_episode_steps=50, reward_threshold=-3.75, ) register( id="Pusher-v2", - entry_point="gym.envs.mujoco:PusherEnv", + entry_point="gymnasium.envs.mujoco:PusherEnv", max_episode_steps=100, reward_threshold=0.0, ) register( id="Pusher-v4", - entry_point="gym.envs.mujoco.pusher_v4:PusherEnv", + entry_point="gymnasium.envs.mujoco.pusher_v4:PusherEnv", max_episode_steps=100, reward_threshold=0.0, ) register( id="InvertedPendulum-v2", - entry_point="gym.envs.mujoco:InvertedPendulumEnv", + entry_point="gymnasium.envs.mujoco:InvertedPendulumEnv", max_episode_steps=1000, reward_threshold=950.0, ) register( id="InvertedPendulum-v4", - entry_point="gym.envs.mujoco.inverted_pendulum_v4:InvertedPendulumEnv", + entry_point="gymnasium.envs.mujoco.inverted_pendulum_v4:InvertedPendulumEnv", max_episode_steps=1000, reward_threshold=950.0, ) register( id="InvertedDoublePendulum-v2", - entry_point="gym.envs.mujoco:InvertedDoublePendulumEnv", + entry_point="gymnasium.envs.mujoco:InvertedDoublePendulumEnv", max_episode_steps=1000, reward_threshold=9100.0, ) register( id="InvertedDoublePendulum-v4", - entry_point="gym.envs.mujoco.inverted_double_pendulum_v4:InvertedDoublePendulumEnv", + entry_point="gymnasium.envs.mujoco.inverted_double_pendulum_v4:InvertedDoublePendulumEnv", max_episode_steps=1000, reward_threshold=9100.0, ) register( id="HalfCheetah-v2", - entry_point="gym.envs.mujoco:HalfCheetahEnv", + entry_point="gymnasium.envs.mujoco:HalfCheetahEnv", max_episode_steps=1000, reward_threshold=4800.0, ) register( id="HalfCheetah-v3", - entry_point="gym.envs.mujoco.half_cheetah_v3:HalfCheetahEnv", + entry_point="gymnasium.envs.mujoco.half_cheetah_v3:HalfCheetahEnv", max_episode_steps=1000, reward_threshold=4800.0, ) register( id="HalfCheetah-v4", - entry_point="gym.envs.mujoco.half_cheetah_v4:HalfCheetahEnv", + entry_point="gymnasium.envs.mujoco.half_cheetah_v4:HalfCheetahEnv", max_episode_steps=1000, reward_threshold=4800.0, ) register( id="Hopper-v2", - entry_point="gym.envs.mujoco:HopperEnv", + entry_point="gymnasium.envs.mujoco:HopperEnv", max_episode_steps=1000, reward_threshold=3800.0, ) register( id="Hopper-v3", - entry_point="gym.envs.mujoco.hopper_v3:HopperEnv", + entry_point="gymnasium.envs.mujoco.hopper_v3:HopperEnv", max_episode_steps=1000, reward_threshold=3800.0, ) register( id="Hopper-v4", - entry_point="gym.envs.mujoco.hopper_v4:HopperEnv", + entry_point="gymnasium.envs.mujoco.hopper_v4:HopperEnv", max_episode_steps=1000, reward_threshold=3800.0, ) register( id="Swimmer-v2", - entry_point="gym.envs.mujoco:SwimmerEnv", + entry_point="gymnasium.envs.mujoco:SwimmerEnv", max_episode_steps=1000, reward_threshold=360.0, ) register( id="Swimmer-v3", - entry_point="gym.envs.mujoco.swimmer_v3:SwimmerEnv", + entry_point="gymnasium.envs.mujoco.swimmer_v3:SwimmerEnv", max_episode_steps=1000, reward_threshold=360.0, ) register( id="Swimmer-v4", - entry_point="gym.envs.mujoco.swimmer_v4:SwimmerEnv", + entry_point="gymnasium.envs.mujoco.swimmer_v4:SwimmerEnv", max_episode_steps=1000, reward_threshold=360.0, ) @@ -253,68 +253,68 @@ register( id="Walker2d-v2", max_episode_steps=1000, - entry_point="gym.envs.mujoco:Walker2dEnv", + entry_point="gymnasium.envs.mujoco:Walker2dEnv", ) register( id="Walker2d-v3", max_episode_steps=1000, - entry_point="gym.envs.mujoco.walker2d_v3:Walker2dEnv", + entry_point="gymnasium.envs.mujoco.walker2d_v3:Walker2dEnv", ) register( id="Walker2d-v4", max_episode_steps=1000, - entry_point="gym.envs.mujoco.walker2d_v4:Walker2dEnv", + entry_point="gymnasium.envs.mujoco.walker2d_v4:Walker2dEnv", ) register( id="Ant-v2", - entry_point="gym.envs.mujoco:AntEnv", + entry_point="gymnasium.envs.mujoco:AntEnv", max_episode_steps=1000, reward_threshold=6000.0, ) register( id="Ant-v3", - entry_point="gym.envs.mujoco.ant_v3:AntEnv", + entry_point="gymnasium.envs.mujoco.ant_v3:AntEnv", max_episode_steps=1000, reward_threshold=6000.0, ) register( id="Ant-v4", - entry_point="gym.envs.mujoco.ant_v4:AntEnv", + entry_point="gymnasium.envs.mujoco.ant_v4:AntEnv", max_episode_steps=1000, reward_threshold=6000.0, ) register( id="Humanoid-v2", - entry_point="gym.envs.mujoco:HumanoidEnv", + entry_point="gymnasium.envs.mujoco:HumanoidEnv", max_episode_steps=1000, ) register( id="Humanoid-v3", - entry_point="gym.envs.mujoco.humanoid_v3:HumanoidEnv", + entry_point="gymnasium.envs.mujoco.humanoid_v3:HumanoidEnv", max_episode_steps=1000, ) register( id="Humanoid-v4", - entry_point="gym.envs.mujoco.humanoid_v4:HumanoidEnv", + entry_point="gymnasium.envs.mujoco.humanoid_v4:HumanoidEnv", max_episode_steps=1000, ) register( id="HumanoidStandup-v2", - entry_point="gym.envs.mujoco:HumanoidStandupEnv", + entry_point="gymnasium.envs.mujoco:HumanoidStandupEnv", max_episode_steps=1000, ) register( id="HumanoidStandup-v4", - entry_point="gym.envs.mujoco.humanoidstandup_v4:HumanoidStandupEnv", + entry_point="gymnasium.envs.mujoco.humanoidstandup_v4:HumanoidStandupEnv", max_episode_steps=1000, ) diff --git a/gymnasium/envs/box2d/__init__.py b/gymnasium/envs/box2d/__init__.py new file mode 100644 index 000000000..04aac955e --- /dev/null +++ b/gymnasium/envs/box2d/__init__.py @@ -0,0 +1,3 @@ +from gymnasium.envs.box2d.bipedal_walker import BipedalWalker, BipedalWalkerHardcore +from gymnasium.envs.box2d.car_racing import CarRacing +from gymnasium.envs.box2d.lunar_lander import LunarLander, LunarLanderContinuous diff --git a/gym/envs/box2d/bipedal_walker.py b/gymnasium/envs/box2d/bipedal_walker.py similarity index 98% rename from gym/envs/box2d/bipedal_walker.py rename to gymnasium/envs/box2d/bipedal_walker.py index 9e5bf0c82..4af127111 100644 --- a/gym/envs/box2d/bipedal_walker.py +++ b/gymnasium/envs/box2d/bipedal_walker.py @@ -5,10 +5,10 @@ import numpy as np -import gym -from gym import error, spaces -from gym.error import DependencyNotInstalled -from gym.utils import EzPickle +import gymnasium +from gymnasium import error, spaces +from gymnasium.error import DependencyNotInstalled +from gymnasium.utils import EzPickle try: import Box2D @@ -21,7 +21,7 @@ revoluteJointDef, ) except ImportError: - raise DependencyNotInstalled("box2D is not installed, run `pip install gym[box2d]`") + raise DependencyNotInstalled("box2D is not installed, run `pip install gymnasium[box2d]`") if TYPE_CHECKING: @@ -98,7 +98,7 @@ def EndContact(self, contact): leg.ground_contact = False -class BipedalWalker(gym.Env, EzPickle): +class BipedalWalker(gymnasium.Env, EzPickle): """ ### Description This is a simple 4-joint walker robot environment. @@ -112,7 +112,7 @@ class BipedalWalker(gym.Env, EzPickle): A heuristic is provided for testing. It's also useful to get demonstrations to learn from. To run the heuristic: ``` - python gym/envs/box2d/bipedal_walker.py + python gymnasium/envs/box2d/bipedal_walker.py ``` ### Action Space @@ -142,8 +142,8 @@ class BipedalWalker(gym.Env, EzPickle): To use to the _hardcore_ environment, you need to specify the `hardcore=True` argument like below: ```python - import gym - env = gym.make("BipedalWalker-v3", hardcore=True) + import gymnasium + env = gymnasium.make("BipedalWalker-v3", hardcore=True) ``` ### Version History @@ -611,7 +611,7 @@ def render(self): from pygame import gfxdraw except ImportError: raise DependencyNotInstalled( - "pygame is not installed, run `pip install gym[box2d]`" + "pygame is not installed, run `pip install gymnasium[box2d]`" ) if self.screen is None and self.render_mode == "human": @@ -758,8 +758,8 @@ def __init__(self): raise error.Error( "Error initializing BipedalWalkerHardcore Environment.\n" "Currently, we do not support initializing this mode of environment by calling the class directly.\n" - "To use this environment, instead create it by specifying the hardcore keyword in gym.make, i.e.\n" - 'gym.make("BipedalWalker-v3", hardcore=True)' + "To use this environment, instead create it by specifying the hardcore keyword in gymnasium.make, i.e.\n" + 'gymnasium.make("BipedalWalker-v3", hardcore=True)' ) diff --git a/gym/envs/box2d/car_dynamics.py b/gymnasium/envs/box2d/car_dynamics.py similarity index 99% rename from gym/envs/box2d/car_dynamics.py rename to gymnasium/envs/box2d/car_dynamics.py index 435a4dec2..036743f00 100644 --- a/gym/envs/box2d/car_dynamics.py +++ b/gymnasium/envs/box2d/car_dynamics.py @@ -12,12 +12,12 @@ import Box2D import numpy as np -from gym.error import DependencyNotInstalled +from gymnasium.error import DependencyNotInstalled try: from Box2D.b2 import fixtureDef, polygonShape, revoluteJointDef except ImportError: - raise DependencyNotInstalled("box2D is not installed, run `pip install gym[box2d]`") + raise DependencyNotInstalled("box2D is not installed, run `pip install gymnasium[box2d]`") SIZE = 0.02 diff --git a/gym/envs/box2d/car_racing.py b/gymnasium/envs/box2d/car_racing.py similarity index 98% rename from gym/envs/box2d/car_racing.py rename to gymnasium/envs/box2d/car_racing.py index 9ba35a2ff..c422a894f 100644 --- a/gym/envs/box2d/car_racing.py +++ b/gymnasium/envs/box2d/car_racing.py @@ -5,17 +5,17 @@ import numpy as np -import gym -from gym import spaces -from gym.envs.box2d.car_dynamics import Car -from gym.error import DependencyNotInstalled, InvalidAction -from gym.utils import EzPickle +import gymnasium +from gymnasium import spaces +from gymnasium.envs.box2d.car_dynamics import Car +from gymnasium.error import DependencyNotInstalled, InvalidAction +from gymnasium.utils import EzPickle try: import Box2D from Box2D.b2 import contactListener, fixtureDef, polygonShape except ImportError: - raise DependencyNotInstalled("box2D is not installed, run `pip install gym[box2d]`") + raise DependencyNotInstalled("box2D is not installed, run `pip install gymnasium[box2d]`") try: # As pygame is necessary for using the environment (reset and step) even without a render mode @@ -24,7 +24,7 @@ from pygame import gfxdraw except ImportError: raise DependencyNotInstalled( - "pygame is not installed, run `pip install gym[box2d]`" + "pygame is not installed, run `pip install gymnasium[box2d]`" ) @@ -102,7 +102,7 @@ def _contact(self, contact, begin): obj.tiles.remove(tile) -class CarRacing(gym.Env, EzPickle): +class CarRacing(gymnasium.Env, EzPickle): """ ### Description The easiest control task to learn from pixels - a top-down @@ -113,7 +113,7 @@ class CarRacing(gym.Env, EzPickle): steering wheel position, and gyroscope. To play yourself (it's rather fast for humans), type: ``` - python gym/envs/box2d/car_racing.py + python gymnasium/envs/box2d/car_racing.py ``` Remember: it's a powerful rear-wheel drive car - don't press the accelerator and turn at the same time. @@ -157,7 +157,7 @@ class CarRacing(gym.Env, EzPickle): `domain_randomize` must be `True` on init for this argument to work. Example usage: ```py - env = gym.make("CarRacing-v1", domain_randomize=True) + env = gymnasium.make("CarRacing-v1", domain_randomize=True) # normal reset, this changes the colour scheme by default env.reset() diff --git a/gym/envs/box2d/lunar_lander.py b/gymnasium/envs/box2d/lunar_lander.py similarity index 97% rename from gym/envs/box2d/lunar_lander.py rename to gymnasium/envs/box2d/lunar_lander.py index 87185c43a..d619186af 100644 --- a/gym/envs/box2d/lunar_lander.py +++ b/gymnasium/envs/box2d/lunar_lander.py @@ -6,11 +6,11 @@ import numpy as np -import gym -from gym import error, spaces -from gym.error import DependencyNotInstalled -from gym.utils import EzPickle, colorize -from gym.utils.step_api_compatibility import step_api_compatibility +import gymnasium +from gymnasium import error, spaces +from gymnasium.error import DependencyNotInstalled +from gymnasium.utils import EzPickle, colorize +from gymnasium.utils.step_api_compatibility import step_api_compatibility try: import Box2D @@ -23,7 +23,7 @@ revoluteJointDef, ) except ImportError: - raise DependencyNotInstalled("box2d is not installed, run `pip install gym[box2d]`") + raise DependencyNotInstalled("box2d is not installed, run `pip install gymnasium[box2d]`") if TYPE_CHECKING: @@ -72,7 +72,7 @@ def EndContact(self, contact): self.env.legs[i].ground_contact = False -class LunarLander(gym.Env, EzPickle): +class LunarLander(gymnasium.Env, EzPickle): """ ### Description This environment is a classic rocket trajectory optimization problem. @@ -88,7 +88,7 @@ class LunarLander(gym.Env, EzPickle): To see a heuristic landing, run: ``` - python gym/envs/box2d/lunar_lander.py + python gymnasium/envs/box2d/lunar_lander.py ``` @@ -139,8 +139,8 @@ class LunarLander(gym.Env, EzPickle): To use to the _continuous_ environment, you need to specify the `continuous=True` argument like below: ```python - import gym - env = gym.make( + import gymnasium + env = gymnasium.make( "LunarLander-v2", continuous: bool = False, gravity: float = -10.0, @@ -605,7 +605,7 @@ def render(self): from pygame import gfxdraw except ImportError: raise DependencyNotInstalled( - "pygame is not installed, run `pip install gym[box2d]`" + "pygame is not installed, run `pip install gymnasium[box2d]`" ) if self.screen is None and self.render_mode == "human": @@ -800,8 +800,8 @@ def __init__(self): raise error.Error( "Error initializing LunarLanderContinuous Environment.\n" "Currently, we do not support initializing this mode of environment by calling the class directly.\n" - "To use this environment, instead create it by specifying the continuous keyword in gym.make, i.e.\n" - 'gym.make("LunarLander-v2", continuous=True)' + "To use this environment, instead create it by specifying the continuous keyword in gymnasium.make, i.e.\n" + 'gymnasium.make("LunarLander-v2", continuous=True)' ) diff --git a/gymnasium/envs/classic_control/__init__.py b/gymnasium/envs/classic_control/__init__.py new file mode 100644 index 000000000..381a132f0 --- /dev/null +++ b/gymnasium/envs/classic_control/__init__.py @@ -0,0 +1,5 @@ +from gymnasium.envs.classic_control.acrobot import AcrobotEnv +from gymnasium.envs.classic_control.cartpole import CartPoleEnv +from gymnasium.envs.classic_control.continuous_mountain_car import Continuous_MountainCarEnv +from gymnasium.envs.classic_control.mountain_car import MountainCarEnv +from gymnasium.envs.classic_control.pendulum import PendulumEnv diff --git a/gym/envs/classic_control/acrobot.py b/gymnasium/envs/classic_control/acrobot.py similarity index 97% rename from gym/envs/classic_control/acrobot.py rename to gymnasium/envs/classic_control/acrobot.py index d618078a0..9972a6303 100644 --- a/gym/envs/classic_control/acrobot.py +++ b/gymnasium/envs/classic_control/acrobot.py @@ -4,8 +4,8 @@ import numpy as np from numpy import cos, pi, sin -from gym import core, spaces -from gym.error import DependencyNotInstalled +from gymnasium import core, spaces +from gymnasium.error import DependencyNotInstalled __copyright__ = "Copyright 2013, RLPy http://acl.mit.edu/RLPy" __credits__ = [ @@ -20,7 +20,7 @@ # SOURCE: # https://github.com/rlpy/rlpy/blob/master/rlpy/Domains/Acrobot.py -from gym.envs.classic_control import utils +from gymnasium.envs.classic_control import utils class AcrobotEnv(core.Env): @@ -97,7 +97,7 @@ class AcrobotEnv(core.Env): No additional arguments are currently supported. ``` - env = gym.make('Acrobot-v1') + env = gymnasium.make('Acrobot-v1') ``` By default, the dynamics of the acrobot follow those described in Sutton and Barto's book @@ -126,7 +126,7 @@ class AcrobotEnv(core.Env): - v1: Maximum number of steps increased from 200 to 500. The observation space for v0 provided direct readings of `theta1` and `theta2` in radians, having a range of `[-pi, pi]`. The v1 observation space as described here provides the sine and cosine of each angle instead. - - v0: Initial versions release (1.0.0) (removed from gym for v1) + - v0: Initial versions release (1.0.0) (removed from gymnasium for v1) ### References - Sutton, R. S. (1996). Generalization in Reinforcement Learning: Successful Examples Using Sparse Coarse Coding. @@ -282,7 +282,7 @@ def render(self): from pygame import gfxdraw except ImportError: raise DependencyNotInstalled( - "pygame is not installed, run `pip install gym[classic_control]`" + "pygame is not installed, run `pip install gymnasium[classic_control]`" ) if self.screen is None: diff --git a/gym/envs/classic_control/assets/clockwise.png b/gymnasium/envs/classic_control/assets/clockwise.png similarity index 100% rename from gym/envs/classic_control/assets/clockwise.png rename to gymnasium/envs/classic_control/assets/clockwise.png diff --git a/gym/envs/classic_control/cartpole.py b/gymnasium/envs/classic_control/cartpole.py similarity index 96% rename from gym/envs/classic_control/cartpole.py rename to gymnasium/envs/classic_control/cartpole.py index a1d404599..6547496f4 100644 --- a/gym/envs/classic_control/cartpole.py +++ b/gymnasium/envs/classic_control/cartpole.py @@ -8,13 +8,13 @@ import numpy as np -import gym -from gym import logger, spaces -from gym.envs.classic_control import utils -from gym.error import DependencyNotInstalled +import gymnasium +from gymnasium import logger, spaces +from gymnasium.envs.classic_control import utils +from gymnasium.error import DependencyNotInstalled -class CartPoleEnv(gym.Env[np.ndarray, Union[int, np.ndarray]]): +class CartPoleEnv(gymnasium.Env[np.ndarray, Union[int, np.ndarray]]): """ ### Description @@ -75,7 +75,7 @@ class CartPoleEnv(gym.Env[np.ndarray, Union[int, np.ndarray]]): ### Arguments ``` - gym.make('CartPole-v1') + gymnasium.make('CartPole-v1') ``` No additional arguments are currently supported. @@ -212,7 +212,7 @@ def render(self): from pygame import gfxdraw except ImportError: raise DependencyNotInstalled( - "pygame is not installed, run `pip install gym[classic_control]`" + "pygame is not installed, run `pip install gymnasium[classic_control]`" ) if self.screen is None: diff --git a/gym/envs/classic_control/continuous_mountain_car.py b/gymnasium/envs/classic_control/continuous_mountain_car.py similarity index 94% rename from gym/envs/classic_control/continuous_mountain_car.py rename to gymnasium/envs/classic_control/continuous_mountain_car.py index 3d427b670..32fbf8bef 100644 --- a/gym/envs/classic_control/continuous_mountain_car.py +++ b/gymnasium/envs/classic_control/continuous_mountain_car.py @@ -7,7 +7,7 @@ of Jose Antonio Martin H. (version 1.0), adapted by 'Tom Schaul, tom@idsia.ch' and then modified by Arnaud de Broissia -* the gym MountainCar environment +* the gymnasium MountainCar environment itself from http://incompleteideas.net/sutton/MountainCar/MountainCar1.cp permalink: https://perma.cc/6Z2N-PFWC @@ -18,13 +18,13 @@ import numpy as np -import gym -from gym import spaces -from gym.envs.classic_control import utils -from gym.error import DependencyNotInstalled +import gymnasium +from gymnasium import spaces +from gymnasium.envs.classic_control import utils +from gymnasium.error import DependencyNotInstalled -class Continuous_MountainCarEnv(gym.Env): +class Continuous_MountainCarEnv(gymnasium.Env): """ ### Description @@ -32,7 +32,7 @@ class Continuous_MountainCarEnv(gym.Env): at the bottom of a sinusoidal valley, with the only possible actions being the accelerations that can be applied to the car in either direction. The goal of the MDP is to strategically accelerate the car to reach the goal state on top of the right hill. There are two versions - of the mountain car domain in gym: one with discrete actions and one with continuous. + of the mountain car domain in gymnasium: one with discrete actions and one with continuous. This version is the one with continuous actions. This MDP first appeared in [Andrew Moore's PhD Thesis (1990)](https://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-209.pdf) @@ -92,7 +92,7 @@ class Continuous_MountainCarEnv(gym.Env): ### Arguments ``` - gym.make('MountainCarContinuous-v0') + gymnasium.make('MountainCarContinuous-v0') ``` ### Version History @@ -112,7 +112,7 @@ def __init__(self, render_mode: Optional[str] = None, goal_velocity=0): self.max_position = 0.6 self.max_speed = 0.07 self.goal_position = ( - 0.45 # was 0.5 in gym, 0.45 in Arnaud de Broissia's version + 0.45 # was 0.5 in gymnasium, 0.45 in Arnaud de Broissia's version ) self.goal_velocity = goal_velocity self.power = 0.0015 @@ -194,7 +194,7 @@ def render(self): from pygame import gfxdraw except ImportError: raise DependencyNotInstalled( - "pygame is not installed, run `pip install gym[classic_control]`" + "pygame is not installed, run `pip install gymnasium[classic_control]`" ) if self.screen is None: diff --git a/gym/envs/classic_control/mountain_car.py b/gymnasium/envs/classic_control/mountain_car.py similarity index 95% rename from gym/envs/classic_control/mountain_car.py rename to gymnasium/envs/classic_control/mountain_car.py index f25aeab91..c85997d7b 100644 --- a/gym/envs/classic_control/mountain_car.py +++ b/gymnasium/envs/classic_control/mountain_car.py @@ -7,13 +7,13 @@ import numpy as np -import gym -from gym import spaces -from gym.envs.classic_control import utils -from gym.error import DependencyNotInstalled +import gymnasium +from gymnasium import spaces +from gymnasium.envs.classic_control import utils +from gymnasium.error import DependencyNotInstalled -class MountainCarEnv(gym.Env): +class MountainCarEnv(gymnasium.Env): """ ### Description @@ -21,7 +21,7 @@ class MountainCarEnv(gym.Env): at the bottom of a sinusoidal valley, with the only possible actions being the accelerations that can be applied to the car in either direction. The goal of the MDP is to strategically accelerate the car to reach the goal state on top of the right hill. There are two versions - of the mountain car domain in gym: one with discrete actions and one with continuous. + of the mountain car domain in gymnasium: one with discrete actions and one with continuous. This version is the one with discrete actions. This MDP first appeared in [Andrew Moore's PhD Thesis (1990)](https://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-209.pdf) @@ -87,7 +87,7 @@ class MountainCarEnv(gym.Env): ### Arguments ``` - gym.make('MountainCar-v0') + gymnasium.make('MountainCar-v0') ``` ### Version History @@ -172,7 +172,7 @@ def render(self): from pygame import gfxdraw except ImportError: raise DependencyNotInstalled( - "pygame is not installed, run `pip install gym[classic_control]`" + "pygame is not installed, run `pip install gymnasium[classic_control]`" ) if self.screen is None: diff --git a/gym/envs/classic_control/pendulum.py b/gymnasium/envs/classic_control/pendulum.py similarity index 96% rename from gym/envs/classic_control/pendulum.py rename to gymnasium/envs/classic_control/pendulum.py index 2a1f11a65..f1fccbaa9 100644 --- a/gym/envs/classic_control/pendulum.py +++ b/gymnasium/envs/classic_control/pendulum.py @@ -5,16 +5,16 @@ import numpy as np -import gym -from gym import spaces -from gym.envs.classic_control import utils -from gym.error import DependencyNotInstalled +import gymnasium +from gymnasium import spaces +from gymnasium.envs.classic_control import utils +from gymnasium.error import DependencyNotInstalled DEFAULT_X = np.pi DEFAULT_Y = 1.0 -class PendulumEnv(gym.Env): +class PendulumEnv(gymnasium.Env): """ ### Description @@ -77,7 +77,7 @@ class PendulumEnv(gym.Env): The default value is g = 10.0 . ``` - gym.make('Pendulum-v1', g=9.81) + gymnasium.make('Pendulum-v1', g=9.81) ``` ### Version History @@ -110,7 +110,7 @@ def __init__(self, render_mode: Optional[str] = None, g=10.0): high = np.array([1.0, 1.0, self.max_speed], dtype=np.float32) # This will throw a warning in tests/envs/test_envs in utils/env_checker.py as the space is not symmetric # or normalised as max_torque == 2 by default. Ignoring the issue here as the default settings are too old - # to update to follow the openai gym api + # to update to follow the openai gymnasium api self.action_space = spaces.Box( low=-self.max_torque, high=self.max_torque, shape=(1,), dtype=np.float32 ) @@ -168,7 +168,7 @@ def render(self): from pygame import gfxdraw except ImportError: raise DependencyNotInstalled( - "pygame is not installed, run `pip install gym[classic_control]`" + "pygame is not installed, run `pip install gymnasium[classic_control]`" ) if self.screen is None: diff --git a/gym/envs/classic_control/utils.py b/gymnasium/envs/classic_control/utils.py similarity index 100% rename from gym/envs/classic_control/utils.py rename to gymnasium/envs/classic_control/utils.py diff --git a/gymnasium/envs/mujoco/__init__.py b/gymnasium/envs/mujoco/__init__.py new file mode 100644 index 000000000..350f75439 --- /dev/null +++ b/gymnasium/envs/mujoco/__init__.py @@ -0,0 +1,19 @@ +from gymnasium.envs.mujoco.mujoco_env import MujocoEnv, MuJocoPyEnv # isort:skip +from gymnasium.envs.mujoco.mujoco_rendering import ( # isort:skip + RenderContextOffscreen, + Viewer, +) + +# ^^^^^ so that user gets the correct error +# message if mujoco is not installed correctly +from gymnasium.envs.mujoco.ant import AntEnv +from gymnasium.envs.mujoco.half_cheetah import HalfCheetahEnv +from gymnasium.envs.mujoco.hopper import HopperEnv +from gymnasium.envs.mujoco.humanoid import HumanoidEnv +from gymnasium.envs.mujoco.humanoidstandup import HumanoidStandupEnv +from gymnasium.envs.mujoco.inverted_double_pendulum import InvertedDoublePendulumEnv +from gymnasium.envs.mujoco.inverted_pendulum import InvertedPendulumEnv +from gymnasium.envs.mujoco.pusher import PusherEnv +from gymnasium.envs.mujoco.reacher import ReacherEnv +from gymnasium.envs.mujoco.swimmer import SwimmerEnv +from gymnasium.envs.mujoco.walker2d import Walker2dEnv diff --git a/gym/envs/mujoco/ant.py b/gymnasium/envs/mujoco/ant.py similarity index 95% rename from gym/envs/mujoco/ant.py rename to gymnasium/envs/mujoco/ant.py index 09e006be6..348512f1b 100644 --- a/gym/envs/mujoco/ant.py +++ b/gymnasium/envs/mujoco/ant.py @@ -1,8 +1,8 @@ import numpy as np -from gym import utils -from gym.envs.mujoco import MuJocoPyEnv -from gym.spaces import Box +from gymnasium import utils +from gymnasium.envs.mujoco import MuJocoPyEnv +from gymnasium.spaces import Box class AntEnv(MuJocoPyEnv, utils.EzPickle): diff --git a/gym/envs/mujoco/ant_v3.py b/gymnasium/envs/mujoco/ant_v3.py similarity index 98% rename from gym/envs/mujoco/ant_v3.py rename to gymnasium/envs/mujoco/ant_v3.py index 751efabdf..9b884c3d2 100644 --- a/gym/envs/mujoco/ant_v3.py +++ b/gymnasium/envs/mujoco/ant_v3.py @@ -1,8 +1,8 @@ import numpy as np -from gym import utils -from gym.envs.mujoco import MuJocoPyEnv -from gym.spaces import Box +from gymnasium import utils +from gymnasium.envs.mujoco import MuJocoPyEnv +from gymnasium.spaces import Box DEFAULT_CAMERA_CONFIG = { "distance": 4.0, diff --git a/gym/envs/mujoco/ant_v4.py b/gymnasium/envs/mujoco/ant_v4.py similarity index 97% rename from gym/envs/mujoco/ant_v4.py rename to gymnasium/envs/mujoco/ant_v4.py index 93782641e..b40302c6b 100644 --- a/gym/envs/mujoco/ant_v4.py +++ b/gymnasium/envs/mujoco/ant_v4.py @@ -1,8 +1,8 @@ import numpy as np -from gym import utils -from gym.envs.mujoco import MujocoEnv -from gym.spaces import Box +from gymnasium import utils +from gymnasium.envs.mujoco import MujocoEnv +from gymnasium.spaces import Box DEFAULT_CAMERA_CONFIG = { "distance": 4.0, @@ -143,13 +143,13 @@ class AntEnv(MujocoEnv, utils.EzPickle): No additional arguments are currently supported in v2 and lower. ``` - env = gym.make('Ant-v2') + env = gymnasium.make('Ant-v2') ``` - v3 and v4 take gym.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc. + v3 and v4 take gymnasium.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc. ``` - env = gym.make('Ant-v4', ctrl_cost_weight=0.1, ...) + env = gymnasium.make('Ant-v4', ctrl_cost_weight=0.1, ...) ``` | Parameter | Type | Default |Description | @@ -166,7 +166,7 @@ class AntEnv(MujocoEnv, utils.EzPickle): ### Version History * v4: all mujoco environments now use the mujoco bindings in mujoco>=2.1.3 - * v3: support for gym.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc. rgb rendering comes from tracking camera (so agent does not run away from screen) + * v3: support for gymnasium.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc. rgb rendering comes from tracking camera (so agent does not run away from screen) * v2: All continuous control environments now use mujoco_py >= 1.50 * v1: max_time_steps raised to 1000 for robot based tasks. Added reward_threshold to environments. * v0: Initial versions release (1.0.0) diff --git a/gym/envs/mujoco/assets/ant.xml b/gymnasium/envs/mujoco/assets/ant.xml similarity index 100% rename from gym/envs/mujoco/assets/ant.xml rename to gymnasium/envs/mujoco/assets/ant.xml diff --git a/gym/envs/mujoco/assets/half_cheetah.xml b/gymnasium/envs/mujoco/assets/half_cheetah.xml similarity index 100% rename from gym/envs/mujoco/assets/half_cheetah.xml rename to gymnasium/envs/mujoco/assets/half_cheetah.xml diff --git a/gym/envs/mujoco/assets/hopper.xml b/gymnasium/envs/mujoco/assets/hopper.xml similarity index 100% rename from gym/envs/mujoco/assets/hopper.xml rename to gymnasium/envs/mujoco/assets/hopper.xml diff --git a/gym/envs/mujoco/assets/humanoid.xml b/gymnasium/envs/mujoco/assets/humanoid.xml similarity index 98% rename from gym/envs/mujoco/assets/humanoid.xml rename to gymnasium/envs/mujoco/assets/humanoid.xml index c8d5fc61a..a263bdbcf 100755 --- a/gym/envs/mujoco/assets/humanoid.xml +++ b/gymnasium/envs/mujoco/assets/humanoid.xml @@ -1,121 +1,121 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gym/envs/mujoco/assets/humanoidstandup.xml b/gymnasium/envs/mujoco/assets/humanoidstandup.xml similarity index 98% rename from gym/envs/mujoco/assets/humanoidstandup.xml rename to gymnasium/envs/mujoco/assets/humanoidstandup.xml index 8dd36ba87..854dbc91c 100755 --- a/gym/envs/mujoco/assets/humanoidstandup.xml +++ b/gymnasium/envs/mujoco/assets/humanoidstandup.xml @@ -1,121 +1,121 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gym/envs/mujoco/assets/inverted_double_pendulum.xml b/gymnasium/envs/mujoco/assets/inverted_double_pendulum.xml similarity index 100% rename from gym/envs/mujoco/assets/inverted_double_pendulum.xml rename to gymnasium/envs/mujoco/assets/inverted_double_pendulum.xml diff --git a/gym/envs/mujoco/assets/inverted_pendulum.xml b/gymnasium/envs/mujoco/assets/inverted_pendulum.xml similarity index 98% rename from gym/envs/mujoco/assets/inverted_pendulum.xml rename to gymnasium/envs/mujoco/assets/inverted_pendulum.xml index 851450429..8fb2db057 100644 --- a/gym/envs/mujoco/assets/inverted_pendulum.xml +++ b/gymnasium/envs/mujoco/assets/inverted_pendulum.xml @@ -1,27 +1,27 @@ - - - - - - - - -