Video from:
Kehrle, F., et. al. (2011), Optimal control of formula 1 race cars in a VDrift based virtual environment
Ihno Schrot
MORFAE Workshop at TU Clausthal on September 21, 2023
OUTLINE
Optimal Control Problem Formulation and Nonlinear Model Predictive Control
Problem Discretization using Direct Multiple Shooting
The Sequential Quadratic Programming Method as Solution Method for the Nonlinear Programs
Real - Time Iterations
Multi - Level Iterations
Optimal Control Problem Formulation and Nonlinear Model Predictive Control
Ihno Schrot — Real-Time Iterations and Multi-Level Iterations — MORFAE Workshop Clausthal — September 21, 2023
Objective Function
Dynamical System
Continuous Constraints
Terminal Constraints
State $$x$$
Control $$u$$
Parameter $$p$$
1. OCP AND NMPC
Ihno Schrot — Real-Time Iterations and Multi-Level Iterations — MORFAE Workshop Clausthal — September 21, 2023
1. OCP AND NMPC
Ihno Schrot — Real-Time Iterations and Multi-Level Iterations — MORFAE Workshop Clausthal — September 21, 2023
\(x\): States
1. OCP AND NMPC
Ihno Schrot — Real-Time Iterations and Multi-Level Iterations — MORFAE Workshop Clausthal — September 21, 2023
1. OCP AND NMPC
\(x\): States
\(u\): Controls
Ihno Schrot — Real-Time Iterations and Multi-Level Iterations — MORFAE Workshop Clausthal — September 21, 2023
1. OCP AND NMPC
\(x\): States
\(u\): Controls
\(p\): Parameters
Ihno Schrot — Real-Time Iterations and Multi-Level Iterations — MORFAE Workshop Clausthal — September 21, 2023
1. OCP AND NMPC
\(x\): States
\(u\): Controls
\(p\): Parameters
Ihno Schrot — Real-Time Iterations and Multi-Level Iterations — MORFAE Workshop Clausthal — September 21, 2023
1. OCP AND NMPC
\(x\): States
\(u\): Controls
\(p\): Parameters
Ihno Schrot — Real-Time Iterations and Multi-Level Iterations — MORFAE Workshop Clausthal — September 21, 2023
1. OCP AND NMPC
\(x\): States
\(u\): Controls
\(p\): Parameters
Ihno Schrot — Real-Time Iterations and Multi-Level Iterations — MORFAE Workshop Clausthal — September 21, 2023
1. Measure current state $$x_k$$
Illustration based on Grüne and Pannek, Nonlinear Model Predictive Control
1. OCP AND NMPC
Ihno Schrot — Real-Time Iterations and Multi-Level Iterations — MORFAE Workshop Clausthal — September 21, 2023
2. Solve OCP for horizon $$[t_k,t_k+T]$$
1. Measure current state $$x_k$$
Illustration based on Grüne and Pannek, Nonlinear Model Predictive Control
1. OCP AND NMPC
Ihno Schrot — Real-Time Iterations and Multi-Level Iterations — MORFAE Workshop Clausthal — September 21, 2023
2. Solve OCP for horizon $$[t_k,t_k+T]$$
1. Measure current state $$x_k$$
3. Apply first part of computed contol
Illustration based on Grüne and Pannek, Nonlinear Model Predictive Control
1. OCP AND NMPC
Ihno Schrot — Real-Time Iterations and Multi-Level Iterations — MORFAE Workshop Clausthal — September 21, 2023
2. Solve OCP for horizon $$[t_k,t_k+T]$$
1. Measure current state $$x_k$$
3. Apply first part of computed contol
4. Progress to time $$t_{k+1}$$
Illustration based on Grüne and Pannek, Nonlinear Model Predictive Control
1. OCP AND NMPC
Ihno Schrot — Real-Time Iterations and Multi-Level Iterations — MORFAE Workshop Clausthal — September 21, 2023
Illustration based on Grüne and Pannek, Nonlinear Model Predictive Control
1. OCP AND NMPC
2. Solve OCP for horizon $$[t_k,t_k+T]$$
4. Progress to time $$t_{k+1}$$
1. Measure current state \(x_k\)
3. Apply first part of computed contol
Ihno Schrot — Real-Time Iterations and Multi-Level Iterations — MORFAE Workshop Clausthal — September 21, 2023
1. OCP AND NMPC
Ihno Schrot — Real-Time Iterations and Multi-Level Iterations — MORFAE Workshop Clausthal — September 21, 2023
OUTLINE
Optimal Control Problem Formulation and Nonlinear Model Predictive Control
Problem Discretization using Direct Multiple Shooting
The Sequential Quadratic Programming Method as Solution Method for the Nonlinear Programs
Real - Time Iterations
Multi - Level Iterations
Ihno Schrot — Real-Time Iterations and Multi-Level Iterations — MORFAE Workshop Clausthal — September 21, 2023
1. Introduce Shooting Grid
State $$x(\cdot)$$
Control $$u(\cdot)$$
2. Replace state trajectory by points
3. Replace control trajectory by, e.g., piecewise constant controls
4. Introduce Matching Conditions
Infinite-Dimensional
Bock, H. G., & Plitt, K. J. (1984). A multiple shooting algorithm for direct solution of optimal control problems.
2. MULTIPLE SHOOTING
Ihno Schrot — Real-Time Iterations and Multi-Level Iterations — MORFAE Workshop Clausthal — September 21, 2023
Finite-dimensional nonlinear program
2. MULTIPLE SHOOTING
Ihno Schrot — Real-Time Iterations and Multi-Level Iterations — MORFAE Workshop Clausthal — September 21, 2023
OUTLINE
Optimal Control Problem Formulation and Nonlinear Model Predictive Control
Problem Discretization using Direct Multiple Shooting
The Sequential Quadratic Programming Method as Solution Method for the Nonlinear Programs
Real - Time Iterations
Multi - Level Iterations
Ihno Schrot — Real-Time Iterations and Multi-Level Iterations — MORFAE Workshop Clausthal — September 21, 2023
Nonlinear System of Equations
SQP Method
Step of Newton's Method
Optimality Conditions
Quadratic Approximation
Quadratic Program
Step $$\Delta x$$
Current Guess $$x_k$$
Solving the QP
Update
3. SQP METHOD
Ihno Schrot — Real-Time Iterations and Multi-Level Iterations — MORFAE Workshop Clausthal — September 21, 2023
In the case of Multiple Shooting:
\(\Delta w \): (Primal) Variables including \(\Delta s_0 \)
\(B_k \): Hessian of Lagrangian
\(b_k \): Objective gradient
\(C_k, D_k \): Jacobians of (in-)equality constraints
\(c_k, d_k \): Residuals of (in-)equality constraints
QP at sampling time \(t_k\):
3. SQP METHOD
Initial Value Embedding Constraint
Depend only on \(w_k\)
Ihno Schrot — Real-Time Iterations and Multi-Level Iterations — MORFAE Workshop Clausthal — September 21, 2023
OUTLINE
Optimal Control Problem Formulation and Nonlinear Model Predictive Control
Problem Discretization using Direct Multiple Shooting
The Sequential Quadratic Programming Method as Solution Method for the Nonlinear Programs
Real - Time Iterations
Multi - Level Iterations
Ihno Schrot — Real-Time Iterations and Multi-Level Iterations — MORFAE Workshop Clausthal — September 21, 2023
Observations:
Efficient solution method: Parametric Active-Set Method implemented in qpOASES
Diehl, M., et. al. (2002). Real-time optimization and nonlinear model predictive control of processes governed by differential-algebraic equations.
1st key idea of RTI:
Perform only a single SQP iteration per sample time
Solve:
Ferreau, H. J., et. al. (2014). qpOASES: A parametric active-set algorithm for quadratic programming.
4. REAL-TIME ITERATIONS
Ihno Schrot — Real-Time Iterations and Multi-Level Iterations — MORFAE Workshop Clausthal — September 21, 2023
Observation: Current state \(x_k\) enters OCPs linearly
2nd key idea of RTI:
Split computations in preparation and feedback phase
Preparation Phase for \(t_k\)
Feedback
Feedback
4. REAL-TIME ITERATIONS
Ihno Schrot — Real-Time Iterations and Multi-Level Iterations — MORFAE Workshop Clausthal — September 21, 2023
OUTLINE
Optimal Control Problem Formulation and Nonlinear Model Predictive Control
Problem Discretization using Direct Multiple Shooting
The Sequential Quadratic Programming Method as Solution Method for the Nonlinear Programs
Real - Time Iterations
Multi - Level Iterations
Ihno Schrot — Real-Time Iterations and Multi-Level Iterations — MORFAE Workshop Clausthal — September 21, 2023
Observation: Linearizations can be valid for a longer time period
Key idea of MLI:
Reduce expensive evaluations by updating the QPs in 4 levels
Wirsching, L. (2018). Multi-Level Iteration Schemes with Adaptive Level Choice for Nonlinear Model Predictive Control.
Level D = RTI
Level C
Level B
Level A
Computational Complexity
Accuracy
Level D = RTI
Level C
Level B
Level A
Levels can run in parallel and communicate with each other.
5. MULTI-LEVEL ITERATIONS
Ihno Schrot — Real-Time Iterations and Multi-Level Iterations — MORFAE Workshop Clausthal — September 21, 2023
Level D = RTI
Computational Complexity
Accuracy
Level D = RTI
Level C
Level B
Level A
Level C
Level B
Level A
5. MULTI-LEVEL ITERATIONS
Ihno Schrot — Real-Time Iterations and Multi-Level Iterations — MORFAE Workshop Clausthal — September 21, 2023
Computational Complexity
Accuracy
Level D = RTI
Level C
Level B
Level A
Level D = RTI
Level D = RTI
Level C
Level B
Level A
Full linearization iterations
5. MULTI-LEVEL ITERATIONS
Ihno Schrot — Real-Time Iterations and Multi-Level Iterations — MORFAE Workshop Clausthal — September 21, 2023
Computational Complexity
Accuracy
Level D = RTI
Level C
Level B
Level A
Level D = RTI
Level D = RTI
Full linearization iterations
Level C
Level B
Level A
Optimality Iterations
No new Hessian and (full) Jacobians!
New Jacobians enter as matrix-vector products only
5. MULTI-LEVEL ITERATIONS
Ihno Schrot — Real-Time Iterations and Multi-Level Iterations — MORFAE Workshop Clausthal — September 21, 2023
Computational Complexity
Accuracy
Level D = RTI
Level C
Level B
Level A
Level D = RTI
Level D = RTI
Full linearization iterations
Level C
Level B
Level A
Optimality Iterations
Feasibility Iterations
No new Jacobians involved
5. MULTI-LEVEL ITERATIONS
Ihno Schrot — Real-Time Iterations and Multi-Level Iterations — MORFAE Workshop Clausthal — September 21, 2023
Computational Complexity
Accuracy
Level D = RTI
Level C
Level B
Level A
Level D = RTI
Level D = RTI
Full linearization iterations
Level C
Level B
Level A
Optimality Iterations
Feasibility Iterations
Feedback Iterations
5. MULTI-LEVEL ITERATIONS
Ihno Schrot — Real-Time Iterations and Multi-Level Iterations — MORFAE Workshop Clausthal — September 21, 2023
4. MLI: Reduce expensive evaluations by updating the QPs in 4 levels
3. RTI: Solve only one QP per sampling time and split computations in preparation and feedback phase
2. Apply an SQP-type method to the NLPs
1. The \(\infty\)-dim. OCP is discretized using Multiple Shooting
SUMMARY
Ihno Schrot — Real-Time Iterations and Multi-Level Iterations — MORFAE Workshop Clausthal — September 21, 2023
4. REAL-TIME ITERATIONS
Ihno Schrot — Real-Time Iterations and Multi-Level Iterations — MORFAE Workshop Clausthal — September 21, 2023
5. MULTI-LEVEL ITERATIONS
Uncontrolled chain
Chain controlled with MLI
Videos from: Wirsching, L. (2018). Multi-Level Iteration Schemes with Adaptive Level Choice for Nonlinear Model Predictive Control.
Ihno Schrot — Real-Time Iterations and Multi-Level Iterations — MORFAE Workshop Clausthal — September 21, 2023