CasADi
AdvancedAn open-source symbolic toolkit for numerical optimization and automatic differentiation, widely used for MPC and trajectory-optimization modeling.
CasADi is an open-source tool for nonlinear optimization and algorithmic differentiation (automatic differentiation), developed by Joel Andersson, Joris Gillis, Moritz Diehl, and others at KU Leuven in Belgium, with support for Python, MATLAB, and C++. Users first write out system dynamics, cost functions, and constraints as symbolic expressions; CasADi then automatically computes gradients, Jacobians, and Hessians, and calls a solver such as IPOPT, qpOASES, or OSQP to solve the resulting problem — it can also generate C code for the whole problem. It solves the pain of deriving derivatives by hand when formulating optimal-control problems, which is slow and error-prone, and has become a standard modeling layer for building model predictive control, trajectory optimization, and parameter identification; acados also uses it to describe models.
ExampleUse CasADi's Opti interface to write a cart-pole swing-up problem — with state and control as decision variables discretized via direct multiple shooting — and call IPOPT to solve for the optimal control sequence.
- Related
- acados (fast embedded optimal control solver) · Interior Point OPTimizer (Ipopt) · Trajectory Optimization · Model Predictive Control · Direct Collocation · Multiple Shooting
- Sources
- CasADi 官网 (Chinese)
casadi/casadi (GitHub)