Skip to main content

Plangym is an interface to use OpenAI gym for planning problems. It extends the standard interface to allow setting and recovering the environment states.

Project description

Welcome to Plangym

Documentation Status Code coverage PyPI package Code style: black license: MIT

Plangym is an open source Python library for developing and comparing planning algorithms by providing a standard API to communicate between algorithms and environments, as well as a standard set of environments compliant with that API.

Given that OpenAI's gym has become the de-facto standard in the research community, plangym's API is designed to be as similar as possible to gym's API while allowing to modify the environment state.

Furthermore, it provides additional functionality for stepping the environments in parallel, delayed environment initialization for dealing with environments that are difficult to serialize, compatibility with gym.Wrappers, and more.

Supported environments

Plangym currently supports all the following environments:

  • OpenAI gym classic control environments
  • OpenAI gym Box2D environments
  • OpenAI gym Atari 2600 environments
  • Deepmind's dm_control environments
  • stable-retro environments

Getting started

Stepping a batch of states and actions

import plangym
env = plangym.make(name="CartPole-v0")
state, obs = env.reset()

states = [state.copy() for _ in range(10)]
actions = [env.action_space.sample() for _ in range(10)]

data = env.step_batch(states=states, actions=actions)
new_states, observs, rewards, ends, infos = data

Using parallel steps

import plangym
env = plangym.make(name="MsPacman-v0", n_workers=2)

state, obs = env.reset()

states = [state.copy() for _ in range(10)]
actions = [env.action_space.sample() for _ in range(10)]

data =  env.step_batch(states=states, actions=actions)
new_states, observs, rewards, ends, infos = data

Installation

Plangym is tested on Ubuntu 20.04 and Ubuntu 21.04 for python versions 3.7 and 3.8.

Installing it with Python 3.6 will break AtariEnvironment, and RetroEnvironment does not support python 3.9 yet.

Installing from Pip

Assuming that the environment libraries that you want to use are already installed, you can install plangym from pip running:

pip3 install plangym

Installing from source

If you also want to install the environment libraries, first clone the repository:

git clone git@github.com:FragileTech/plangym.git
cd plangym

Install the system dependencies by running

sudo apt-get install -y --no-install-suggests --no-install-recommends libglfw3 libglew-dev libgl1-mesa-glx libosmesa6 xvfb swig

To install mujoco, run:

make install-mujoco

Finally, install the project requirements, and plangym.

pip install -r requirements.txt
pip install .

Roadmap

This is a summary of the incoming improvements to the project:

  • Improved documentation:
    • Adding specific tutorials for all the different types of supported environments.
    • Adding a developer guide section for incorporating new environments to plangym.
    • Improving the library docstrings with more examples and detailed information.
  • Better gym integration:
    • Registering all of plangym environments in gym under a namespace.
    • Offering more control over how the states are passed to step, reset and step_batch.
    • Allowing to return the states inside the info dictionary.
  • Adding new environments to plangym, such as:
  • Support for rendering in notebooks that are running on headless machines.

License

ML Ops Quickstart is released under the MIT license.

Contributing

Contributions are very welcome! Please check the contributing guidelines before opening a pull request.

If you have any suggestions for improvement, or you want to report a bug please open an issue.

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

plangym-0.0.19.tar.gz (52.5 kB view details)

Uploaded Source

Built Distribution

plangym-0.0.19-py3-none-any.whl (62.4 kB view details)

Uploaded Python 3

File details

Details for the file plangym-0.0.19.tar.gz.

File metadata

  • Download URL: plangym-0.0.19.tar.gz
  • Upload date:
  • Size: 52.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11

File hashes

Hashes for plangym-0.0.19.tar.gz
Algorithm Hash digest
SHA256 edb339e62826e639f7c8a97b189c0c599062b02d45ec809867e4e58f631b8ea3
MD5 543f262d0382681d44b02cf7c560bcb6
BLAKE2b-256 00daaf26760c4e3af5bd9bc1f4dcbc7452f65973121d69bab059f48d10215523

See more details on using hashes here.

File details

Details for the file plangym-0.0.19-py3-none-any.whl.

File metadata

  • Download URL: plangym-0.0.19-py3-none-any.whl
  • Upload date:
  • Size: 62.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11

File hashes

Hashes for plangym-0.0.19-py3-none-any.whl
Algorithm Hash digest
SHA256 8a98150ab15a92baf0d4f831eddba4002bf29a7323fd1fa2a5ec19cd3377ca04
MD5 3b7504de761018e138af04e0afdd7c99
BLAKE2b-256 77f2caf08e133c7020bc61ad4b4aaf5bd11f0d90608dce363bb17612baccd3fe

See more details on using hashes here.

Supported by

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