---
title: Adaptive Time-Mesh NMPC
url: https://www.emergentmind.com/topics/adaptive-time-mesh-nmpc
type: topic
---

# Adaptive Time-Mesh NMPC

Adaptive Time-Mesh Nonlinear Model Predictive Control (NMPC) comprises a class of algorithms that solve finite-horizon optimal control problems subject to nonlinear system dynamics and constraints, where the discretization of the time horizon is not static but dynamically adapted to optimize either computational efficiency, control accuracy, or convergence and stability properties. In contrast to classical NMPC, which employs a uniform fixed discretization within the receding horizon, adaptive time-mesh NMPC techniques iteratively adjust the temporal discretization online—frequently by refining the grid where high fidelity is needed or shrinking the prediction horizon to accelerate convergence—leveraging error metrics, path tracking priorities, or stability objectives. These methods ensure that the computational load remains bounded or that critical behaviors in the state and control trajectories are resolved accurately, even for challenging nonlinear, high-dimensional, or stiff systems [2004.09561][1803.10512][2009.01332].

## 1. Problem Formulation in Adaptive Time-Mesh NMPC

The general finite-horizon nonlinear optimal control problem underlying adaptive time-mesh NMPC is given by
\[
\begin{align*}
\text{minimize over }u(\cdot),\ T: \quad & J(x_0) = \int_0^T \ell(x(t),u(t))\,dt \\
\text{subject to:} \qquad& \dot{x}(t) = f(x(t),u(t)),\ x(0)=x_0\\
& x(t)\in X,\ u(t)\in U,\ x(T)\in X_f
\end{align*}
\]
where $x\in\mathbb{R}^n$ is the state, $u\in\mathbb{R}^m$ the control, $f$ is nonlinear and $X, U, X_f$ encode state, input, and terminal constraints [2004.09561][1803.10512]. Adaptive time-mesh NMPC methods introduce a non-uniform sequence of time nodes $0 = t_0 < t_1 < \cdots < t_N = T$ for discretization, with node selection evolving during closed-loop operation.

The discretization strategy is integral to the controller’s ability to both meet accuracy requirements in critical segments of the control horizon and bound computational demand to enable real-time control [1803.10512][2009.01332].

## 2. Adaptive Grid Schemes: Shrinking and Refining Horizons

Adaptive grid techniques in NMPC fall into two main categories:

**Shrinking-Horizon Schemes**: In approaches such as the uniform-grid-with-variable-discretization method [2004.09561], the number of shooting nodes $N$ is initially fixed, then systematically reduced by one after each sampling interval until a lower bound $N_{\text{min}}$ is reached, effectively forcing the decision problem’s time horizon to contract. At each step:
- The current state is measured;
- The OCP is solved over the grid $\{u_0,\ldots,u_{N_n-1},x_1,\ldots,x_{N_n},\Delta t\}$ with constraints including $x_{N_n}\in X_f$ and $\Delta t_{\text{min}}\leq \Delta t \leq \Delta t_{\text{max}}$;
- The control $u_0^*$ is applied for $\Delta t_n^*$;
- $N_{n+1} = \max(N_n - 1, N_{\text{min}})$.

This scheme establishes recursive feasibility: for any initial feasible state within the controllability region $P_N(\tau_c)$, the closed-loop trajectory reaches a stabilizable region $P_{N_{\text{min}}}((N_{\text{min}}-1)\Delta t_{\max})$ and remains feasible thereafter [2004.09561].

**Time-Mesh Refinement**: Methods such as those based on a-posteriori error indicators or local discretization error estimates [1803.10512][2009.01332] dynamically refine the mesh only in those sub-horizons affecting upcoming controls most significantly. Specifically:
- The mesh is adapted by inserting new discretization nodes where error estimates $\epsilon_k > \text{err}_\text{trs}$ for the predicted trajectory.
- Refinement is often restricted to $N_\text{tm}$ initial mesh intervals, as these most impact near-term control.
- Interpolation (e.g., cubic Hermite) is used to initialize new node values.
- The overall problem is re-solved after each refinement, typically for a fixed number of iterations or until all local errors are below threshold [1803.10512].

A third approach, a-posteriori, residual-based adaptivity, is leveraged in the context of PDE (parabolic PDE) controlled systems [2009.01332]:
- Time-steps are refined by estimating local residuals of the (non)linear optimality system;
- Large-residual intervals are bisected until desired error equidistribution is achieved;
- The first refined time-step length also determines the application horizon over which control is held constant.

## 3. Discretization Structures and NLP Formulations

Adaptive time-mesh strategies necessitate different formulations for numerical solution:

- **Global Uniform Grid (Single $\Delta t$)**: Decision variables are $\{x_0,\dots,x_N, u_0,\dots,u_{N-1}, \Delta t\}$. All dynamic constraints couple to $\Delta t$, leading to dense Jacobian/Hessian structures.

- **Local Uniform Grid (Multiple $\Delta t_k$)**: The variables $\{x_0,\dots,x_N, u_0,\dots,u_{N-1}, \Delta t_0,\dots,\Delta t_{N-1}\}$ are used under the constraint $\Delta t_k = \Delta t_{k+1}$ for uniformity. Dynamics couple each $\Delta t_k$ to only one interval, yielding sparse, banded Jacobians/Hessians independent of $N$ [2004.09561].

- **Least-Squares Formulation in Flat Output Space**: If the system is differentially flat, the OCP is formulated over flat outputs $\zeta_{0:N}$, with costs and dynamics encoded as residuals, and mesh expansion realized by adding points as needed during real-time operation. The Jacobian remains block-banded due to local dependencies [1803.10512].

The table below summarizes decision variables and sparsity structures in two canonical adaptive schemes:

| Discretization Scheme          | Decision Variables                    | Jacobian/Hessian Sparsity          |
|-------------------------------|---------------------------------------|------------------------------------|
| Global Uniform Grid           | $\{x_k, u_k, \Delta t\}$              | Dense wrt. $\Delta t$              |
| Local Uniform Grid            | $\{x_k, u_k, \Delta t_k\}$            | Sparse, banded (local coupling)    |

## 4. Recursive Feasibility and Stability Considerations

Adaptive time-mesh NMPC ensures recursive feasibility through controllability region design and grid updating rules. For shrinking-horizon schemes, any feasible trajectory with $N$ steps will, under contraction of the horizon and suitable bounds on step size, reach the region
\[
P = P_{N_{\text{min}}}((N_{\text{min}}-1)\Delta t_{\text{max}})
\]
in finite time and remain feasible therein [2004.09561].

Stability, particularly asymptotic stability, depends on the choice of $N_{\text{min}}$ and grid adaptation:
- If $N_{\text{min}}>1$, after the horizon stabilizes, the NMPC cost ceases to decrease, and asymptotic stability may be lost. This is addressed via a dual-mode design: once the state enters a terminal region $X_\text{lin}$, a local stabilizing feedback $u_\text{lin}$ guarantees asymptotic convergence. 
- If $N_{\text{min}}=1$ and using single-step integration (e.g., Euler), first-order optimality yields $f(x_f,u^*)=0$ at $x=x_f,$ so the optimizer enforces invariance at the equilibrium, delivering nominal asymptotic stability without requiring a dual-mode switch [2004.09561].

Practical stabilizing region size can be reduced by decreasing $N_{\text{min}}$ or $\Delta t_{\max}$ [2004.09561].

## 5. Error Estimation and Mesh Adaptivity Criteria

Refinement schemes [1803.10512][2009.01332] utilize local error criteria to determine where mesh points should be added:
- In flat output discretizations, error is estimated as $\epsilon_k = \|\hat{\zeta}_k - \zeta_k\|_2$, where $\hat{\zeta}_k$ is computed via finer internal integration.
- In residual-based approaches for systems governed by PDEs, the indicator $\eta^2 = \sum_i \int_{t_{i-1}}^{t_i} (\Delta t_i)^2| \text{residual} |^2 \, dx\,dt$ is used; intervals with largest indicators are bisected until the mesh reaches the desired number of nodes or error threshold [2009.01332].

Refinement is typically focused on the beginning of the control horizon, as these nodes exert the strongest influence on imminent feedback.

## 6. Computational Efficiency and Implementation

Adaptive time-mesh NMPC methods maintain real-time feasibility and reduce computational cost by limiting the number of optimization variables and focusing resolution where it is most beneficial:
- Band-sparse structures allow Gauss-Newton solvers to exploit computational cost $\sim O(N m^3)$, with $N$ the number of nodes and $m$ the number of flat outputs [1803.10512].
- Performance benchmarks on UAV and oscillator systems show that adaptive schemes outperform fixed-uniform-mesh implementations, both in terms of solution time per NMPC step (sub-ms for UAV/ground robots) and in accuracy per number of discretization points. For instance, in UAV pose regulation, $N=20$ with adaptive mesh achieves comparable RMS error to $N=50$ fixed mesh, with solve times $\sim1$ ms [1803.10512].
- Implementation leverages data structures supporting dynamic insertion/removal of mesh points, banded residual/Jacobian computation, and analytic or numeric differentiation for efficiency.
- For systems requiring switching between full NMPC and local LQR stabilization, such as in dual-mode schemes, adaptive mesh reduces transition CPU time, supporting embedded and industrial hardware constraints [2004.09561].

## 7. Applications, Extensions, and Performance Analysis

Adaptive time-mesh NMPC has been validated in the following contexts:
- Tracking and stabilization for nonlinear oscillators (e.g., Van der Pol) using shrinking-horizon and local uniform grid adaptation [2004.09561].
- UAV pose and trajectory regulation using time-mesh refinement and flat outputs, with open-source C++ implementation available [1803.10512].
- Linear parabolic PDEs (e.g., heat equation), where the mesh adapts both prediction and application horizons via a-posteriori error control [2009.01332].
- Comparative results demonstrate that adaptive schemes handle coarser grids or shorter horizons (smaller $N$) without sacrificing tracking performance or stability, enabling computation times several times lower compared to fixed-grid approaches [2004.09561][1803.10512][2009.01332].

Adaptive schemes have been extended in principle to nonlinear PDEs by linearizing the optimality system, using residual-based indicators and mesh refinement, though rigorous stability and convergence guarantees in the fully nonlinear setting require further investigation. Main challenges include managing residual-based weights as the iterate evolves, ensuring stability of linearization under coarse meshes, and controlling solver convergence as the mesh is updated [2009.01332].

---

**References:**  
- [2004.09561]  
- [1803.10512]  
- [2009.01332]

Source: https://www.emergentmind.com/topics/adaptive-time-mesh-nmpc