Skip to content

ParNMPC : A Parallel Computing Toolbox for Nonlinear MPC

Version 1903-1 (Github: ParNMPC) has been released!

Introduction

ParNMPC is a MATLAB real-time optimization toolkit for nonlinear model predictive control (NMPC). The purpose of ParNMPC is to provide an easy-to-use environment for NMPC problem formulation, closed-loop simulation, and deployment.

With ParNMPC, you can define your own NMPC problem in a very easy way and ParNMPC will automatically generate self-contained C/C++ code for single- or multi-core CPUs.

ParNMPC is very fast even with only one core (the computation time is usually in the range of \mus), and a high speedup can be achieved when parallel computing is enabled.

Features

  • Symbolic problem representation
  • Automatic parallel C/C++ code generation with OpenMP
  • Fast rate of convergence (up to be superlinear)
  • Highly parallelizable (capable of using at most N cores, N is the # of discretization steps)
  • High speedup ratio
  • MATLAB & Simulink

Problems Supported in ParNMPC

The optimal control problem (OCP) supported in ParNMPC has the following form:

\begin{align} \min_{x(\cdot),\ u(\cdot)}&\int^{T}_{0}L\left(u(t),x(t),p(t)\right)dt \\ \text{s.t.}\quad &x(0) = \bar{x}_0,\\ &M\left(u(t),x(t),p(t)\right)\dot{x}(t)=f\left(u(t),x(t),p(t)\right),\quad t\in[0,T],\\ & C(u(t),x(t),p(t))=0,\quad t\in[0,T],\\ & G\left(u(t),x(t),p(t)\right)\geq 0,\quad t\in[0,T]. \end{align}

Here,

Sign Size Description Sign Size Description
u [dim.u,1] Input vector L [1,1] Cost function
x [dim.x,1] State vector C [dim.mu,1] Equality constraint function
p [dim.p,1] Given parameter vector f [dim.x,1] Dynamics
T [1,1] Prediction horizon M [dim.x,dim.x] (Optional, e.g., Lagrange model)
\bar{x}_0 [dim.x,1] Current state vector G [dim.z,1] Polytopic constraint function (G is linear in u and x)

Note

With the parameter p, you can achive

  • Time-variant dynamics and references
  • Terminal cost function and constraint

How ParNMPC works

ParNMPC discretizes the OCP defined above into the following problem with N steps:

\begin{align} \min_{x,\ u}\sum_{i=1}^{N}&L(u_i,x_i,p_i) \\ \text{s.t.}\quad & x_0 = \bar{x}_0,\\ &F(x_{i-1},u_i,x_i,p_i)=0, \quad i\in\{1,\cdots,N\},\\ & C(u_i,x_i,p_i)=0,\quad i\in\{1,\cdots,N\},\\ & G(u_i,x_i,p_i) \geq 0,\quad i\in\{1,\cdots,N\}. \end{align}

Here, F(x_{i-1},u_i,x_i,p_i)=0 is the discretized state-space model. ParNMPC solves the discretized OCP using the parallel primal-dual interior-point method, where the inequality constraints G(u_i,x_i,p_i) \geq 0 are transferred into logarithmic barrier functions with a barrier parameter \rho.

Variables

Variable Size Description
\lambda [dim.lambda,N] Lagrange multiplier corresponding to F
\mu [dim.mu,N] Lagrange multiplier corresponding to C
u [dim.u,N]
x [dim.x,N]
z [dim.z,N] Lagrange multiplier corresponding to G
\Lambda (LAMBDA) [dim.x,dim.x,N] Sensitivity