This repository contains the code for the paper "Stochastic Optimal Control for Nonlinear Systems based on Sampling & Deep Learning" by Andreas Bott, Kirill Kuroptev, and Florian Steinke. The paper is currently under Review for the 63rd IEEE Conference on Decision and Control (CDC 2024).
For questions regarding this conde, please contact Andreas Bott ([email protected] / [email protected])
Stochastic optimal control requires an adequate representation of state uncertainty. For stochastic nonlinear systems, the probability distribution over the states given measurements can often not be represented in closed form. In this paper, we thus propose to address this control task based on Monte-Carlo sampling, integrating the state estimation step with stochastic gradient descent-based control optimisation. A deep neural network approximation of the nonlinear system is the key to speeding up both parts. We motivate and demonstrate the approach for district heating systems, where the security of supply shall be guaranteed with high probability in the face of uncertain consumer demands. Our conceptually simple approach enables representing multimodal distributions and achieving computation times feasible for the online operation of district heating systems.
The paper which belongs to this code is currently under review. If you use the code, please contact Andreas Bott ([email protected]).
|-- utilities/ ββββββββ ββ-> contains the requirements.txt file for the python environment
|-- grids/ ββββββ β β β β-> stores topography files of the heating grid
|
|--Settings.py ββ ββββββββ-> Main configuration file
|--generate_training_data.py: βββ -> script to generate training data; designed to run multiple instances in parallel
|--generate_samples_fixed_pp.py β -> script to generate samples with constant pp setpoints; designed to run multiple instances in parallel
|--train_DNN.pyββββ β ββββ-> script to train the DNN
|--perfect_knowledge_baseline.py β -> Evaluates the true best scheduling via gridsearch
|--plot_control_process.pyβββββ-> Exexcutes the different steps of the proposed algorithm and plot intermediate reults
|--run_randomised_experiments.pyβ-> Execute the proposed algorithm with random inputs and report the results
|
|--lib_dnn_soc:
β|-- utility/
ββ|-- plot_functions.pyβββ -> Functions for plotting the results
ββ|-- _plot_functions/ β β β-> Belongs to plot_functions.py
ββ|-- setup.py β β βββ β-> Setup functions for the experiments
ββ|-- _setup_functions.pyββ-> Belongs to setup.py
ββ|-- utility.py β β β β ββ-> Utility functions for the experiments
β|-- steady_state_modelling/ β
ββ|-- state_equations.py β β-> Contains the modelling equations
ββ|-- steady_state_solvers.py -> Contains solvers for the state equations
β|-- DNN_lib/ βββ β ββ β->
ββ|-- se_NN_lib.py ββ β β -> Contains the custom layers, the neural network class, etc.
ββ|-- _DNN_utility.pyββββ -> Defines class for data handling
ββ|-- importance_sampling.py -> Implements the importance sampling algorithm used for training data generation
β|-- state_estimation/ βββ β
ββ|-- utility.py ββββββ β-> Selector function for different state estimators
ββ|-- state_estimator.pyβββ-> Parent class of all state estimators
ββ|-- det_linear.py βββββ -> Linear state estimator
ββ|-- sir.py β β β β ββ β -> Sampling importace resampling estimator (proposed algorithm)
ββ|-- mcmc.pyβ ββββββ-> Markov Chain Monte Carlo estimator
ββ|-- settings_estimator.pyββ-> Load predefined estimation from settings file
β|-- dispatch_opt/ βββββ β
ββ|-- optimisation_problem.py Β -> Defines the optimisation problem
ββ|-- optimisation_problem.py Β -> Defines the optimisation problem
ββ|-- linear_state_model.py β -> Defines a linear state model to replace the DNN in the OPT problem
ββ|-- grid_search.pyβ β β β-> Implements the grid search to find the true best solution
β|-- evaluation_functions/
ββ|-- evaluation_functions.pyβ-> Function to evaluate the performance of the algorithms
\