Skip to content

Computationally tractable learning-based nonlinear tube MPC using difference of convex neural network dynamic approximation

Notifications You must be signed in to change notification settings

martindoff/DC-NN-MPC

Repository files navigation

DC-NN-MPC

Computationally tractable learning-based nonlinear tube MPC using difference of convex neural network dynamic approximation


Logo

Input-Convex Neural Network architecture whose kernel weights $\Theta$ are constrained to be non-negative and activation functions are convex non-decreasing (e.g. ReLU)

About The Project

Learning-based robust tube-based MPC of dynamic systems approximated by difference-of-convex (DC) Neural Network models. Successive linearisations of the learned dynamics in DC form are performed to express the MPC scheme as a sequence of convex programs. Convexity in the learned dynamics is exploited to bound successive linearisation errors tightly and treat them as bounded disturbances in a robust MPC scheme. Application to a PVTOL aircraft model. This novel computationally tractabe tube-based MPC algorithm is presented in the paper "Computationally tractable nonlinear robust MPC via DC programming" by Martin Doff-Sotta and Mark Cannon. It is an extension of our previous work here and here

DC Neural Network

In order to derive a sequence of convex programs, the dynamics are learned in DC form using DC Neural Network models. These are obtained by stacking two Input-Convex Neural Networks models whose kernel weights are constrained to be non-negative and activation functions are convex non-decreasing (e.g. ReLU).

Built With

  • Python 3
  • CVXPY
  • MOSEK
  • Keras

Prerequisites

You need to install the following:

In a terminal command line, run the following to install all modules at once

pip3 install numpy matplotlib tensorflow cvxpy Mosek 

Using solver Mosek requires a license. Follow the instructions here to obtain it.

Running the code

  1. To clone the repository in the current location, run the following in the terminal

    git clone https://github.com/martindoff/DC-NN-MPC.git
  2. Go to directory

    cd DC-NN-MPC
  3. Run the program

    python3 main.py

Options

  1. To load an existing model, set the load variable in main.py to True
   load = True

Set the variable to False if the model has to be (re)trained.

  1. The tube parameterisation can be chosen via the set_param variable in main.py. For a tube cross section parameterised by means of elementwise bounds, set

    set_param = 'elem'

    For a tube parameterised by means of simplex sets:

    set_param = 'splx'

Results

The DC decomposition of the system dynamics $f = f_1 - f_2$, where $f_1, f_2$ are convex is illustrated below


Logo

DC decomposition with DC Neural Networks

The closed-loop solution is presented below


Logo

Closed-loop tube MPC solution