# 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 $\mu$s), 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

## Problems Supported in ParNMPC

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

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:

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$.
$\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