Skip to main content

A framework to designe Reinforcement Learning (RL) environments for Active Flow Control (AFC), as well as a playground to train Deep Reinforcement Learning (DRL) algorithms for AFC applications.

Project description

Python Version License: MIT Code style: black pre-Commit Check Build and Test

Gym-preCICE

Gym-preCICE is a Python preCICE adapter fully compliant with Gymnasium (also known as OpenAI Gym) API to facilitate designing and developing Reinforcement Learning (RL) environments for single- and multi-physics active flow control (AFC) applications. In an actor-environment setting, Gym-preCICE takes advantage of preCICE, an open-source coupling library for partitioned multi-physics simulations, to handle information exchange between a controller (actor) and an AFC simulation environment. The developed framework results in a seamless non-invasive integration of realistic physics-based simulation toolboxes with RL algorithms.

Installation

Main required dependencies

Gymnasium: Installed by default. Refer to the Gymnasium for more information.

preCICE: You need to install the preCICE library. Refer to the preCICE documentation for information on building and installation.

preCICE Python bindings: Installed by default. Refer to the python language bindings for preCICE for information.

Installing the package

We support and test for Python versions 3.7 and higher on Linux. We recommend installing Gym-preCICE within a virtual environment, e.g. conda:

  • create and activate a conda virtual environment:
 conda create -n gymprecice python=3.8
 conda activate gymprecice

PIP version

  • install the adapter:
python3 -m pip install gymprecice
  • run a simple test to check gymprecice installation (this should pass silently without any error/warning messages):
python3 -c "import gymprecice"

The default installation does not include extra dependencies to run tests or tutorials. You can install these dependencies like python3 -m pip install gymprecice[test], or python3 -m pip install gymprecice[tutorial], or use python3 -m pip install gymprecice[all] to install all extra dependencies.

Development version

  • if you are contributing a pull request, it is best to install from the source:
git clone https://github.com/gymprecice/gymprecice.git
cd gymprecice
pip install -e .
pip install -e .[dev]
pre-commit install

Testing

We use pytest framework to run unit tests for all modules in our package. You need to install required dependencies before running any test:

python3 -m pip install gymprecice[test]
  • To run the full test suits:
pytest ./tests
  • To run a specific unit test, e.g. to test core module (core.py):
pytest ./tests/test_core.py

Usage

Please refer to tutorials for the details on how to use the adapter. You can check out the Quickstart in our tutorials repository to try a ready-to-run control case. You need to install some of the required dependencies before running any tutorial:

python3 -m pip install gymprecice[tutorial]

Citing Us

If you use Gym-preCICE, please cite the following paper:

@misc{shams2023gymprecice,
      title={Gym-preCICE: Reinforcement Learning Environments for Active Flow Control},
      author={Mosayeb Shams and Ahmed H. Elsheikh},
      year={2023},
      eprint={2305.02033},
      archivePrefix={arXiv}
}

Contributing

See the contributing guidelines CONTRIBUTING.md for information on submitting issues and pull requests.

The Team

Gym-preCICE and its tutorials are primarily developed and maintained by:

  • Mosayeb Shams (@mosayebshams) - Lead Developer (Heriot-Watt University)
  • Ahmed H. Elsheikh(@ahmed-h-elsheikh) - Supervisor (Heriot-Watt University)

Acknowledgements

This work was supported by the Engineering and Physical Sciences Research Council grant number EP/V048899/1.

License

Gym-preCICE and its tutorials are MIT licensed.

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

gymprecice-0.1.0.tar.gz (23.0 kB view details)

Uploaded Source

Built Distribution

gymprecice-0.1.0-py3-none-any.whl (21.3 kB view details)

Uploaded Python 3

File details

Details for the file gymprecice-0.1.0.tar.gz.

File metadata

  • Download URL: gymprecice-0.1.0.tar.gz
  • Upload date:
  • Size: 23.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.16

File hashes

Hashes for gymprecice-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5c44f45e2b26f38f06dc94211f5da5f97ba089da4df6284a54f30678407954e6
MD5 889559256d8795a489ced55251f2d706
BLAKE2b-256 d4f162fc43728d44a931f5c1c553591c7b7bc2ac7ee812006d9ec428a96d4ad3

See more details on using hashes here.

File details

Details for the file gymprecice-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: gymprecice-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 21.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.16

File hashes

Hashes for gymprecice-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 06352456ac2376d196c1fef673fe6d96ad4b399610302ed7afa1594a5a9f9285
MD5 ea7c8c41e82c4caa8cff8a7a8d870dfd
BLAKE2b-256 3837aa7c3be6dbc1f525c334241f3527f66e6db8a5125abd8f103074639a4394

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