Developed and delivered through the Process Control Laboratory, K. N. Toosi University of Technology.
Lecturers: Hamzeh Kashi Yarandi & MohammadReza Ghobadzadeh
Language: Persian
Primary tools: MATLAB, CasADi, IPOPT
This workshop connects the mathematical foundations of optimal control and nonlinear programming with the practical implementation of receding-horizon control using MATLAB and CasADi.
The workshop begins with an overview of Model Predictive Control (MPC) and its application landscape, develops the CasADi concepts required for numerical implementation, and concludes with a hands-on nonlinear MPC implementation for point stabilization of a mobile robot.
To avoid unnecessary duplication, foundational material that overlaps with the Numerical Optimal Control Workshop is linked as a shared prerequisite rather than copied into this repository.
| Session | Topic | Video |
|---|---|---|
| 01 | Workshop Overview & MPC Landscape | Watch on YouTube |
| 02 | CasADi Foundations & Algorithmic Differentiation | Watch on YouTube |
| — | Shared Prerequisites from the Numerical Optimal Control Workshop | See prerequisite path |
| 03 | MPC Formulation & Hands-on Nonlinear MPC Implementation | Watch on YouTube |
Full MPC playlist: Model Predictive Control using CasADi
- Session 1 — Workshop Overview & MPC Landscape
- Session 2 — CasADi Foundations & Algorithmic Differentiation
- Complete the Shared Prerequisites from the Numerical Optimal Control Workshop:
- CasADi symbolics, function objects, root finding, and ODE/DAE tools
- Numerical optimization and nonlinear programming
- Direct Single Shooting
- Direct Multiple Shooting
- Session 3 — MPC Formulation & Hands-on Implementation
- Model Predictive Control and receding-horizon optimization
- Optimal Control Problem (OCP) and Nonlinear Programming (NLP) viewpoints
- CasADi and efficient symbolic computation
- Computational graphs and Algorithmic Differentiation
- Numerical optimization and direct shooting methods as MPC prerequisites
- Point stabilization and trajectory-tracking concepts
- State and input constraints
- Single Shooting MPC
- Multiple Shooting MPC
- Prediction horizon and sampling time
- Quadratic state and control penalties
- Closed-loop MPC simulation
- Horizon shifting and warm-start initialization
- Selected advanced directions including distributed, tube, and learning-based MPC
Model-Predictive-Control-using-CasADi/
├── README.md
├── ACKNOWLEDGEMENTS.md
├── .gitignore
├── Session-01-Overview-and-MPC-Landscape/
│ └── README.md
├── Session-02-CasADi-and-Algorithmic-Differentiation/
│ └── README.md
├── Shared-Prerequisites/
│ └── README.md
└── Session-03-Nonlinear-MPC-Implementation/
├── README.md
├── MPC_sing_shooting.m
├── MPC_mul_shooting.m
├── shift.m
└── Draw_MPC_point_stabilization_v1.m
- MATLAB
- CasADi for MATLAB
- IPOPT through CasADi
Make sure CasADi is installed and available on your MATLAB path before running the examples. For example:
addpath('C:\path\to\casadi')
import casadi.*The repository intentionally does not contain machine-specific CasADi paths.
The main implementation codes are provided in Session 03:
MPC_sing_shooting.m— nonlinear MPC using a Single Shooting formulationMPC_mul_shooting.m— nonlinear MPC using a Multiple Shooting formulationshift.m— applies the first control move and shifts the control sequence for the next MPC iterationDraw_MPC_point_stabilization_v1.m— visualization of the closed-loop trajectory, predictions, and control inputs
The shared numerical optimal-control foundations used by this workshop are available in:
Numerical Optimal Control Workshop
https://github.com/Hamzehkashi/Numerical-Optimal-Control-Workshop
See Shared Prerequisites for the recommended session-by-session path.
This workshop was developed with reference to established educational resources in numerical optimal control, MPC, and CasADi. See ACKNOWLEDGEMENTS.md for details.
No repository-wide open-source license is currently applied. Some workshop material draws on or adapts concepts and examples from third-party educational resources. Users should consult ACKNOWLEDGEMENTS.md and the original sources before redistributing or reusing third-party-derived material.