CasADi: a software framework for nonlinear optimization and optimal control
read more
Citations
Enabling New Flexibility in the SUNDIALS Suite of Nonlinear and Differential/Algebraic Equation Solvers.
Neural Ordinary Differential Equations
Mini Cheetah: A Platform for Pushing the Limits of Dynamic Quadruped Control
All you need to know about model predictive control for buildings
Model Predictive Control of Power Electronic Systems: Methods, Results, and Challenges
References
Convex Optimization
On the implementation of an interior-point filter line-search algorithm for large-scale nonlinear programming
LLVM: a compilation framework for lifelong program analysis & transformation
AMPL: A Modeling Language for Mathematical Programming
Lapack Users' Guide
Related Papers (5)
On the implementation of an interior-point filter line-search algorithm for large-scale nonlinear programming
Survey Constrained model predictive control: Stability and optimality
Model predictive control: theory and practice—a survey
Frequently Asked Questions (16)
Q2. What is the way to express conditional expressions?
Conditional expressions, which include switches and if-statements, can be expressed using a dedicated Switch function object class in CasADi.
Q3. What is the purpose of a fast VM?
In a framework such as CasADi, which is frequently used for rapid prototyping with many design iterations, fast VMs are important not only for numerical evaluation, but also for symbolic processing, which can make up a significant portion of the total solution time.
Q4. What is the drawback of the variational approach to sensitivity analysis?
A potential drawback, which is inherent with this so-called variational approach to sensitivity analysis, is that when used inside a gradient-based optimization code, the calculated derivatives may not be consistent with the nondifferentiated function evaluation, due to differences in time discretization.
Q5. What is the class of the function class that calculates directional derivatives?
How a function class calculates directional derivatives is class-specific; e.g., an integrator node typically generates functions for directional derivatives by augmenting the ODE/DAE integration with its sensitivity equations.
Q6. What is the definition of a linear solver class in CasADi?
The linear solver class is a plugin class in CasADi, and leaves to the derived class – typically an interface to a third-party linear solver – to actually perform the factorization and solution.
Q7. How can expressions be used to efficiently obtain derivatives using AD?
Once the expressions have been created, they can be used to efficiently obtain new expressions for derivatives using AD or be evaluated efficiently, either in CasADi’s virtual machines or by using CasADi to generate self-contained C code.
Q8. sym ( ’ x ’ ) z=SX ?
sym ( ’ x ’ , 2 ) z=SX . sym ( ’ z ’ ) u=SX . sym ( ’ u ’ ) f = v e r t c a t ( z∗x [0]−x [ 1 ] + u , \\ x [ 0 ] ) g=x [1 ]∗∗2+ z−1 h=x [0 ]∗∗2+ x [1 ]∗∗2+ u∗∗2 dae= d i c t ( x=x , p=u , ode=f , \\z=z , a l g =g , quad=h )# C r e a t e s o l v e r i n s t a n c e T = 1 0 .
Q9. What is the way to exploit the sparse structure of the Jacobian?
To exploit this block sparse structure, CasADi implements a hierarchical sparsity pattern calculation algorithm based on graph coloring.
Q10. What is the purpose of encapsulating subexpressions into separate function objects?
Encapsulating subexpressions used multiple times into separate function objects allows expression graphs to stay small and has implications for the memory use in the context of algorithmic differentiation, cf. Section 2.6.
Q11. What is the type of Jacobians that are unlikely to be encountered in random locations?
For the type of Jacobians typically encountered in CasADi, both in simulation and optimization, the nonzeros are unlikely to be encountered in random locations.
Q12. How many rows or columns can be calculated in a single sparsity propagation sweep?
CasADi uses the 64-bit unsigned long long datatype for this, meaning that up to 64 rows or columns can be calculated in a single sparsity propagation sweep.
Q13. sym ( ’ p ’ ) z=1x?
sym ( ’ x ’ , 2 ) p=SX . sym ( ’ p ’ ) z=1−x [ 1 ]∗∗2 f = v e r t c a t ( z∗x [0]−x [ 1 ] + p , \\x [ 0 ] )dae= d i c t ( x=x , p=p , ode= f )#
Q14. What is the definition of linear solver?
The linear solver instances are embedded into CasADi’s MX expression graphs using a dedicated linear solve node, which is similar to the more generic function call node introduced in Section 2.3.
Q15. How many sweeps are needed to calculate the sparsity pattern?
For this example, the sparsity pattern is thus recovered in 7 sweeps, which can be compared with ceil(100,000/64) = 1,563 sweeps needed for the naive algorithm, where 64 rows or columns are calculated in each sweep.
Q16. What is the heuristic to calculate the Jacobian sparsity pattern?
Algorithm 1 Heuristic to calculate complete Jacobians in CasADiCalculate the Jacobian sparsity pattern if J is symmetric (typically a Hessian) thenRun a star-coloring algorithm.elseif