Skip to main content

Framework that builds on the garage toolkit for the evaluation and development of constrained RL algorithms.

Project description

jaisalab: A Toolkit for Safe RL

jaisalab is a framework for developing and evaluating reinforcement learning algorithms that take into account constraints that should be satisfied in OpenAI gym environments, that also provides PyTorch implementations for a few state-of-the-art algorithms in Constrained RL. Namely, the algorithms implemented are Constrained Policy Optimization (CPO) <https://github.com/jaimesabalimperial/jaisalab/blob/master/jaisalab/algos/cpo.py>, the Safety Augmented RL (SAUTE) <https://github.com/jaimesabalimperial/jaisalab/blob/master/jaisalab/envs/saute_env.py> wrapper that incorporates safety to any RL algorithm in a plug-n-play manner, and Distributional Constrained Policy Optimization, a modification to CPO that exploits uncertainty in the cost value function to better satisfy constraints.

The framework builds on the garage <https://github.com/rlworkgroup/garage>_ toolkit to add functionality to safe RL settings (i.e. where there is a cost associated with each state-action pair on top of the reward) and thus provides an auxiliary set of modular tools for implementing constrained RL algorithms, analogously to how garage provides these for regular RL settings.

Running Unit and Integration Tests

This project uses pytest for unit and integration testing (included in the developer dependencies). The tests may be run from the root directory as follows:

.. code-block:: console

$ pytest
...
===== x passed, x warnings in x.xx seconds =====

Instructions for Experiment Reproduction

The final results for DCPO, Saute TRPO, Vanilla TRPO, and CPO showed in the final report are equivalent to the experiments in jaisalab.experiments.backlog <https://github.com/jaimesabalimperial/jaisalab/blob/master/jaisalab/experiments/backlog.py>_, ran across seeds 1-10. The evaluation of the trained algorithms is done through the SeedEvaluator object for 30 epochs and the plots are made using the methods of the RLPlotter object.

References

The code implementations for the algorithms present in jaisalab are based partly or fully on the repositories of their respective papers. For CPO, the original TensorFlow implementation can be found in here <https://github.com/jachiam/cpo>, but this had to be translated to PyTorch to fit our framework. For SAUTE, the implementation was much more straightforward since it's simply a wrapper around the environment, rather than a separate algorithm that should fit our framework as a whole, so the code present in jaisalab/envs/safe_env and jaisalab/envs/saute_env was taken directly from Huawei's repository <https://github.com/huawei-noah/HEBO> (more specifically here <https://github.com/huawei-noah/HEBO/tree/405dc4ceb93a79f0d1f0eaa24f5458dd26de1d05/SAUTE/envs/wrappers>_).

Citing jaisalab

If you use jaisalab for academic research, please cite the repository using the following BibTeX entry. You should update the commit field with the commit or release tag your publication uses.

.. code-block:: console

@misc{jaisalab,
author = {Jaime Sabal Bermúdez},
title = {jaisalab: A garage-based framework for reproducible constrained reinforcement learning research},
year = {2022},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/jaimesabalimperial/jaisalab}},
commit = {cc5bc6b4dc7074af1f47d21c6d312429b2ccb931}

Notes

Developed in partial fulfillment of the individual project of Jaime Sabal Bermúdez for the MSc degree in Artificial Intelligence of Imperial College London.

I would like to thank Dr. Calvin Tsay for his guidance and advice throughout the project.

Disclaimer: While jaisalab is an open-source project and contributions are welcome, we cannot guarantee that the codebase will be actively maintained in the future.

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

jaisalab-0.0.1.tar.gz (50.5 kB view details)

Uploaded Source

Built Distribution

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

jaisalab-0.0.1-py3-none-any.whl (63.5 kB view details)

Uploaded Python 3

File details

Details for the file jaisalab-0.0.1.tar.gz.

File metadata

  • Download URL: jaisalab-0.0.1.tar.gz
  • Upload date:
  • Size: 50.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.13

File hashes

Hashes for jaisalab-0.0.1.tar.gz
Algorithm Hash digest
SHA256 6e14e412b5528042523124349e47ce3b2c5e0e743c24f715bca2ff18b21d57d0
MD5 0e3942a5c9db35c40fd416ca4334081b
BLAKE2b-256 ad101fb9e0799a5079190372cc06a0a68d0fa2e78ba6728dadd69d033500a728

See more details on using hashes here.

File details

Details for the file jaisalab-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: jaisalab-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 63.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.13

File hashes

Hashes for jaisalab-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 339c35359375ca8df9ee78a06284a11a01cbe5716d7ce25a7a2e219f733add4f
MD5 e06bb96d065a302182b6cf8623b0280e
BLAKE2b-256 c7f336e2ccf6c2e4a2372b96cafd3148b2b0bcc66115d723823d2a458ab8f05d

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