This repository contains code for the paper "Synthesizing Neural Network Controllers with Closed-Loop Dissipativity Guarantees".
See train_controller.py
for example usage.
models
: controller models.- See comments at the top of each file for further information on each model.
- The model we present, that ensures closed-loop dissipativity, is implemented in
dissipative_simplest_RINN.py
. - An unconstrained recurrent implicit neural network (RINN) model is implemented in
RINN.py
.
envs
: plant models.trainers.py
: trainers modified to include the projection step.trained_controllers
: contains the parameters for the trained controllers used in the experiments in the paper. See the paper or the comments in the relevant file in themodels
folder for how to form the controller from the parameters.
train_controller.py
: configure and train controllers.
This code is tested with Python 3.10. Note that the code is configured to use Mosek, which requires a license (of which an academic one is freely available).
With the appropriate python version activated (for example, using pyenv), use either of the following options to install dependencies.
Install dependencies with Poetry (recommended)
poetry install
. This will install some items then error. The following commands will resolve the error.poetry run pip install setuptools==65.5.0 pip==21
poetry run pip install wheel==0.38.0
poetry run pip install gym==0.21
- Now run
poetry install
again.
Then, controller training can be run with poetry run python train_controller.py
.
Note: this option may require installing system dependencies such as cmake, ninja-build, and compilers for C, C++, and Fortran. The poetry installation system handles these dependencies.
pip install -r requirements.txt
. This will install some items then error. The following commands will resolve the error.pip install setuptools==65.5.0 pip==21
pip install wheel==0.38.0
pip install gym==0.21
- Now run
pip install -r requirements.txt
again.
Then, controller training can be run with python train_controller.py
.