CasADi is a symbolic framework for numeric optimization implementing automatic differentiation by source code transformation in forward and reverse modes on sparse matrix-valued computational graphs. It interfaces state-of-the-art codes such as Sundials integrators and IPOPT nonlinear solver, and offers front-ends to Python and Octave.