Skip to main content

gymDSM (Didactically Supercharged Mod): a small library that provides didactically enhanced OpenAI Gym environments (e.g., a MountainCar variant whose render color shows the last action).

Project description

gymDSM

gymDSM (Didactically Supercharged Mod): A modified version of OpenAI Gym.

What is gymDSM?

gymDSM is a small Python package that provides didactically enhanced (teaching-friendly) variants of classic OpenAI Gym environments.

MountainCar

At the moment, gymDSM focuses on MountainCar with a small (but important) visual modification: the car’s color reflects the last action taken:

  • 0 (push left) → red
  • 1 (no push) → blue
  • 2 (push right) → green

The goal is to make it easier to understand what an agent is doing while interacting with the environment.

Installation

The library gymDSM is on the Python Package Index. To install the library, first install pip and then use the command pip install gymDSM. Alternatively, you can use pip install gymdsm. Remember that pip/PyPI treat distribution names case-insensitively.

This project is intended to work with Gym 0.22. You can install it with the command pip install gym==0.22.

On the other hand, if you want to use render(), you need to use the following installation command:

pip install gymDSM[render]

(The command above installs pygame as an optional dependency.)


Minimal Working Example (MWE)

1) Create the environment using gymDSM.make

This is designed to be easily replaceable with the usual Gym pattern:

import gymDSM as gymDSM

env = gymDSM.make("MountainCar-v0")

obs = env.reset()
done = False

while not done:
    action = env.action_space.sample()  # random policy
    obs, reward, done, info = env.step(action)

env.close()

2) Render (optional)

import gymDSM as gymDSM
import time

env = gymDSM.make("MountainCar-v0")
obs = env.reset()

done = False
while not done:
    env.render()  # requires pygame
    action = env.action_space.sample()
    obs, reward, done, info = env.step(action)
    time.sleep(0.02)

env.close()

Behavior and supported environments

For now, only the gym's Mountain Car environment is supported.

  • If you call:

    env = gymDSM.make("MountainCar-v0")
    

    gymDSM will try to create the gymDSM MountainCar variant (with action-based colors).

  • If env_id is not supported by gymDSM, or if creating the gymDSM version fails for any reason, gymDSM.make(...) falls back to:

    gym.make(env_id, ...)
    

    using the standard Gym environment.

License and Acknowledgments

gymDSM is an independent open-source project that originates from a fork of OpenAI Gym. This project is not affiliated with or endorsed by OpenAI. gymDSM is developed for research and educational purposes. It builds upon the foundation laid by the OpenAI Gym library, and we acknowledge and thank the original OpenAI Gym authors and contributors for their pioneering work.

Both gymDSM and the original OpenAI Gym are released under the MIT License. We have retained the original project's MIT licensing for gymDSM, ensuring that any use or distribution of this fork complies with the same terms. Please see the LICENSE file in this repository for the full text of the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gymdsm-1.0.0.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gymdsm-1.0.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file gymdsm-1.0.0.tar.gz.

File metadata

  • Download URL: gymdsm-1.0.0.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for gymdsm-1.0.0.tar.gz
Algorithm Hash digest
SHA256 96a16b1171752db76aa62638a9a5c9f7d6575b92c8be67a7d72ba8c459f82fa6
MD5 9f5381fe00b1b2c5c603adbdd712b89f
BLAKE2b-256 59d52881080547a4d343a88255c55c206dde4b82db1e20ba9e655b3a4fc1ccfe

See more details on using hashes here.

File details

Details for the file gymdsm-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: gymdsm-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for gymdsm-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 497fae98a5fc137540f19cbb9d836acc9eae8aad7e35050e719c2a935c5934a2
MD5 51d85fb333f002bad60bac99b0d225f0
BLAKE2b-256 644f81de36b43b84ae79fe3e87a124f30da8b72e14e03f1625913f8047b72535

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page