holl- / PDE-Control

Code for the ICLR 2020 paper "Learning to Control PDEs"
MIT License
29 stars 8 forks source link

Learning to Control PDEs with Differentiable Physics

Code for the ICLR 2020 paper.

Authors: Philipp Holl, Vladlen Koltun, Nils Thuerey.

This project is based on the differentiable simulation framework ΦFlow.

Installation

To run the code, you will need Python 2.7, 3.6 or newer.

Clone this repository including ΦFlow by running the following command.

$ git clone --recursive https://github.com/holl-/PDE-Control.git

Install the dependencies by executing the below command inside the root directory of your cloned repository.

$ pip install PDE-Control/PhiFlow/[gui] jupyterlab tensorflow==1.14.0 matplotlib

Reproducing the experiments

This repository contains a revised version of the code used in the ICLR paper, now based on ΦFlow 1.4. The new version features well-documented Jupyter notebooks to reproduce the experiments.

The original code is based on an old version of ΦFlow which can be found under /legacy.

Experiment 1: Burgers equation

Launch Jupyter notebook by executing the following command in the root directory of the repository.

$ jupyter notebook

In the browser, navigate into the notebooks directory and open Control Burgers.ipynb.

Experiment 2: Shape transition

Open Shape Transitions.ipynb using Jupyter notebook (as explained for Experiment 1). We recommend reading through Control Burgers.ipynb first.

Other Experiments

Only the above mentioned experiments are available as Jupyter notebooks. The code reproducing the other experiments can be found in /legacy.

Extending the method to other equations

This project uses the physics framework of ΦFlow. The function world.step() is used to run the differentiable simulation, both for data generation and network training.

The physics of a control problem and correponding network architectures are encapsulated in the class PDE in control.pde.pde_base. For reference, have a look at the implementation of IncrementPDE, BurgersPDE, and IncompressibleFluidPDE

To implement your own physics or networks, subtype the PDE class and pass it to the ControlTraining constructor. ControlTraining will automatically initialize states and call world.step().