Tricks for faster MPC in Casadi
Running faster MPC
When dealing with nonlinear Model Predicive Control (MPC), there is often a question on how to make the code faster. I will consider the general purpose optimization library casadi
.
A few main key factors are essential to speed up your solution time.
1) Warm-starting 2) Use to_function()
to save your mpc controller
The process of warm staring consists on letting the solver save the previous solution as the initial guess for the next iteration. Indeed, in problems like MPC, where the same optimization problem is solved repeateadly for many iterations, it is critical to reuse as much computation as possible.
On the other hand, the use of the method to_function
from Opti
is always suggested to speed0up your MPC code. We can have a look at an example
Enjoy Reading This Article?
Here are some more articles you might like to read next: