pnnl / neuromancer

Pytorch-based framework for solving parametric constrained optimization problems, physics-informed system identification, and parametric model predictive control.
https://pnnl.github.io/neuromancer/
Other
913 stars 120 forks source link

Differentiable gymnasium environments #164

Closed Diego-Llanes closed 3 months ago

Diego-Llanes commented 4 months ago

This pull request contains the Differentiable Acrobot and Differentiable Pendulum feature addition.

The files that have additions / changes are:

File Type of change
src/neuromancer/psl/gymnasium_environments/ New directory
src/neuromancer/psl/gymnasium_environments/acrobot.py Created file, and created acrobot class
src/neuromancer/psl/gymnasium_environments/pendulum.py Created file, and created pendulum class
src/neuromancer/psl/gymnasium_environments/gym_utils.py Created file, and some utilities for Gymnasium Environments
src/neuromancer/psl/gymnasium_environments/acrobot.py Created file, and created acrobot class
src/neuromancer/psl/nonautonomous.py Imported Differentiable Gymnasium Environments and added them to systems dict
src/neuromancer/psl/plot.py Created rendering software for Differentiable Gymnasium Environments with gymnasium as an optional dependency, also created some nice "paper style" plotting software for control and system identification for each environment
examples/domain_examples/farama_blackbox_dpc.ipynb Notebook outlining how to use the Gymnasium Environments for blackbox control
examples/domain_examples/farama_whitebox_dpc.ipynb Notebook outlining how to use the Gymnasium Environments for whitebox control
examples/domain_examples/pretrained_weights New directory; containing weights for the notebooks to load so that users do not have to wait excessive periods of time for results

All of the file changes have been well documented with doc strings where applicable. Small testcases have also been introduced for these additions where applicable.

Open TODO: Change the import for StridedDataset in farama_blackbox_dpc.ipynb to be from neuromancer instead of a local import. The reason that it references this outside import is because there is an open pull request for this feature that has not been merged into main yet and I needed to test to make sure the notebooks were functional.

Contributors:

RBirmiwal commented 3 months ago

@Diego-Llanes closing for now. Please see Jan's comments and if you have bandwidth to create a minimal PR showcasing white-box DPC on pendulum we can go from there