Metadata-Version: 2.1
Name: carl-bench
Version: 1.1.0
Summary: CARL- Contextually Adaptive Reinforcement Learning
Home-page: https://www.automl.org/
Author: Carolin Benjamins, Theresa Eimer, Frederik Schubert, André Biedenkapp, Aditya Mohan, Sebastian Döhler
Author-email: benjamins@tnt.uni-hannover.de
License: Apache 2.0
Project-URL: Documentation, https://automl.github.io/CARL
Project-URL: Source Code, https://github.com/https://github.com/automl/CARL
Keywords: RL,Generalization,Context,Reinforcement Learning
Platform: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Natural Language :: English
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: POSIX :: Linux
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Software Development
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: gym
Requires-Dist: gymnasium >=0.27.1
Requires-Dist: pygame
Requires-Dist: scipy >=1.7.0
Requires-Dist: ConfigArgParse >=1.5.1
Requires-Dist: numpy >=1.19.5
Requires-Dist: pandas >=1.3.0
Requires-Dist: matplotlib >=3.4.2
Requires-Dist: dataclasses >=0.6
Requires-Dist: numpyencoder >=0.3.0
Requires-Dist: pyglet >=1.5.15
Requires-Dist: pytablewriter >=0.62.0
Requires-Dist: PyYAML >=5.4.1
Requires-Dist: tabulate >=0.8.9
Requires-Dist: bs4 >=0.0.1
Requires-Dist: configspace >=0.7.1
Requires-Dist: omegaconf >=2.3.0
Provides-Extra: box2d
Requires-Dist: gymnasium[box2d] >=0.27.1 ; extra == 'box2d'
Provides-Extra: brax
Requires-Dist: brax ==0.9.3 ; extra == 'brax'
Requires-Dist: protobuf >=3.17.3 ; extra == 'brax'
Requires-Dist: mujoco ==3.0.1 ; extra == 'brax'
Provides-Extra: dev
Requires-Dist: pytest >=6.1.1 ; extra == 'dev'
Requires-Dist: pytest-cov ; extra == 'dev'
Requires-Dist: mypy ; extra == 'dev'
Requires-Dist: black ; extra == 'dev'
Requires-Dist: flake8 ; extra == 'dev'
Requires-Dist: isort ; extra == 'dev'
Requires-Dist: pydocstyle ; extra == 'dev'
Requires-Dist: pre-commit ; extra == 'dev'
Provides-Extra: dm_control
Requires-Dist: dm-control >=1.0.3 ; extra == 'dm_control'
Provides-Extra: docs
Requires-Dist: sphinx >=4.2.0 ; extra == 'docs'
Requires-Dist: sphinx-gallery >=0.10.0 ; extra == 'docs'
Requires-Dist: image >=1.5.33 ; extra == 'docs'
Requires-Dist: sphinx-autoapi >=1.8.4 ; extra == 'docs'
Requires-Dist: automl-sphinx-theme >=0.1.9 ; extra == 'docs'
Provides-Extra: examples
Requires-Dist: stable-baselines3 ; extra == 'examples'
Provides-Extra: mario
Requires-Dist: opencv-python >=4.8.0 ; extra == 'mario'
Requires-Dist: torch >=1.9.0 ; extra == 'mario'
Requires-Dist: Pillow >=8.3.1 ; extra == 'mario'
Requires-Dist: py4j >=0.10.9.2 ; extra == 'mario'
Requires-Dist: pyvirtualdisplay >=3.0 ; extra == 'mario'
Requires-Dist: jdk4py >=17.0.7.0 ; extra == 'mario'

<img align="left" width="80" src="./docs/source/figures/CARL_logo.png" alt="CARL">

# – The Benchmark Library
[![PyPI Version](https://img.shields.io/pypi/v/carl-bench.svg)](https://pypi.python.org/pypi/carl-bench)
[![Test](https://github.com/automl/carl/actions/workflows/tests.yaml/badge.svg)](https://github.com/automl/carl/actions/workflows/tests.yaml)
[![Doc Status](https://github.com/automl/carl/actions/workflows/docs.yaml/badge.svg)](https://github.com/automl/carl/actions/workflows/docs.yaml)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

CARL (context adaptive RL) provides highly configurable contextual extensions
to several well-known RL environments.
It's designed to test your agent's generalization capabilities
in all scenarios where intra-task generalization is important.

Feel free to check out our [paper](https://arxiv.org/abs/2110.02102) and our short [blog post](https://www.automl.org/carl-a-benchmark-to-study-generalization-in-reinforcement-learning/)!

## Benchmarks
Benchmarks include:
- [OpenAI gym classic control suite](https://gym.openai.com/envs/#classic_control) extended with several physics context features like gravity or friction

- [OpenAI gym Box2D](https://gym.openai.com/envs/#box2d) BipedalWalker, LunarLander and
  CarRacing, each with their own modification possibilities like
  new vehicles to race

- All [Brax locomotion environments](https://github.com/google/brax) with exposed internal features like joint strength or torso mass

- [Super Mario (TOAD-GAN)](https://github.com/Mawiszus/TOAD-GAN), a procedurally generated jump'n'run game with control
  over level similarity

- [dm_control](https://github.com/deepmind/dm_control), environments based on the MuJoCo physics engine. The environments are extended with different context features.

![Screenshot of each environment included in CARL.](./docs/source/figures/envs_overview.png)

For more information, check out our [documentation](https://automl.github.io/CARL/)!


## Installation
We recommend you use a virtual environment (e.g. Anaconda) to
install CARL and its dependencies. We recommend and test with python 3.9 under Linux.

First, clone our repository and install the basic requirements:
```bash
git clone https://github.com/automl/CARL.git --recursive
cd CARL
pip install .
```

This will only install the basic classic control environments, which should run on most operating systems. For the full set of environments, use the install options:
```bash
pip install -e .[box2d,brax,dm_control,mario,rna]
```

These may not be compatible with Windows systems. Box2D environment may need to be installed via conda on MacOS systems:
```bash
conda install -c conda-forge gym-box2d
```

In general, we test on Linux systems, but aim to keep the benchmark compatible with MacOS as much as possible.
RNA and Mario at this point, however, will not run on any operation system besides Linux.

To install ToadGAN for the Mario environment:
```bash
# System requirements
sudo apt install libfreetype6-dev xvfb
```

If you want to use RNA, please take a look at the associated [ReadME](carl/envs/rna/readme.md).

## CARL's Contextual Extension
CARL contextually extends the environment by making the context visible and configurable.
During training we therefore can encounter different contexts and train for generalization.
We exemplarily show how Brax' Fetch is extended and embedded by CARL.
Different instiations can be achieved by setting the context features to different values.

![CARL contextually extends Brax' Fetch.](./docs/source/figures/concept.png)

## Cite Us
If you use CARL in your research, please cite our paper on the benchmark:
```bibtex
@inproceedings { BenEim2023a,
  author       = {Carolin Benjamins and
                  Theresa Eimer and
                  Frederik Schubert and
                  Aditya Mohan and
                  Sebastian Döhler and
                  André Biedenkapp and
                  Bodo Rosenhahn and
                  Frank Hutter and
                  Marius Lindauer},
  title        = {Contextualize Me - The Case for Context in Reinforcement Learning},
  journal      = {Transactions on Machine Learning Research},
  year         = {2023},
}

```

## References
[OpenAI gym, Brockman et al., 2016. arXiv preprint arXiv:1606.01540](https://arxiv.org/pdf/1606.01540.pdf)

[Brax -- A Differentiable Physics Engine for Large Scale
Rigid Body Simulation, Freeman et al., NeurIPS 2021 (Dataset &
Benchmarking Track)](https://arxiv.org/pdf/2106.13281.pdf)

[TOAD-GAN: Coherent Style Level Generation from a Single Example,
Awiszus et al., AIIDE 2020](https://arxiv.org/pdf/2008.01531.pdf)

[dm_control: Software and Tasks for Continuous Control](https://arxiv.org/pdf/2006.12983.pdf)

## License
CARL falls under the Apache License 2.0 (see file 'LICENSE') as is permitted by all
work that we use. This includes CARLMario, which is not based on the Nintendo Game, but on
TOAD-GAN and TOAD-GUI running under an MIT license. They in turn make use of the Mario AI framework
(https://github.com/amidos2006/Mario-AI-Framework). This is not the original game but a replica,
explicitly built for research purposes and includes a copyright notice (https://github.com/amidos2006/Mario-AI-Framework#copyrights ).
