Performance of Casadi vs. Acado for NMPC

4,464 views
Skip to first unread message

Pablo González

unread,
Feb 9, 2017, 8:40:42 AM2/9/17
to CasADi
Hello, 

in a recently accepted paper I used Casadi (through the MPC toolbox developed by J.B. Rawlings' group) to benchmark an approach to NMPC in terms of numerical (i.e. time to find solution) performance. The benchmark was multiple shooting with ipopt as solver.

One reviewer suggested using acado to benchmark the developed approach as it more accurately represents the state of the art. I was a bit reluctant as both the approach on the paper as the benchmark based on casadi work with Python and (as far as I could find) acado with matlab. The question is, would acado really perform better than casadi? the optimization problem has a total of 60 decision variables and the system to be controlled is 4th order.

Thank you.

Joel Andersson

unread,
Feb 9, 2017, 9:52:42 AM2/9/17
to CasADi
Hi Pablo!

All the tools have pros and cons. This is more or less how they are related:

1. ACADO is a tool especially for NMPC implementing a structure exploiting SQP solver. It was developed in the same group as CasADi (with Moritz Diehl, then in Leuven, Belgium), but the scope is different. Whereas ACADO targets very fast NMPC for small to medium size systems with a tailored optimization method, CasADi is a much more general purpose optimization framework. If you use CasADi to implement the same method as is implemented in ACADO (the direct multiple shooting method), chances are that ACADO will be faster, at least for small-medium size systems. The two main reasons why ACADO would win out is that the sensitivity analysis is probably more optimized and since they have more better support for structure-exploiting SQP. We're working on both these things in CasADi, in a general-purpose setting, and we've made some progress: Integrators are getting better and better and we now have two different structure-exploiting SQP methods - "scpgen" and "blocksqp", both of which is work-in-progress however. Now, most people use CasADi not to implement direct multiple shooting, but direct collocation. And for direct collocation, with e.g. IPOPT as your NLP solver, CasADi is very fast. So it's more of a question of whether direct multiple shooting or direct collocation is a better approach for your problem. In general, I would expect CasADi (and direct collocation/IPOPT) to win out over ACADO for systems that are (1) larger, more than 20 state variables or so, (2) have a non-quadratic cost function, afaik ACADO only does Gauss-Newton SQP, not exact Hessian (3) problems with a lot of sparsity in the model equations, and (4) many problems with long time horizon. A lot will come down to *how* you use CasADi and/or ACADO. There are lots of knobs to turn. Note that for direct collocation, the speed bottleneck is often not CasADi but the NLP solver (IPOPT), or the sparse linear solver inside IPOPT (e.g. MA27/MA57).

2. There is a rewrite of ACADO underway called ACADOS https://github.com/acados/acados. As of today, it is probably not quite ready for prime-time, but it's progressing fast so you might want to have a look at that. It's being developed by people in Moritz Diehl's group, who's now in Freiburg, Germany. ACADOS is a complete rewrite of ACADO, but unlike ACADO uses the symbolics of CasADi and the C code generation functionality. They pick-and-choose the parts of CasADi they need, for example I don't think they plan to use CasADi's NLP solvers other than for testing.

3. MPC tools - CasADi is developed by Michael Risbeck in Rawlings' group in Madison. That's where I am now, by the way, Michael and I sit in the same office. It represents an abstraction layer on top of CasADi and the focus is rapid prototyping of a range of different NMPC algorithms. The idea is to have an easy-to-use environment that be used in both research and teaching. It's also "hackable", you should be able to jump into the code and modify it with relative ease. In terms of speed, see (1) above.

I hope that makes things clearer!
Joel
Reply all
Reply to author
Forward
0 new messages