Porting from ACADO toolkit: Equivalent of "acado_preparationStep"?


I’m porting code that was written for the ACADO toolkit. I came across the function acado_preparationStep() that apparently must be called to initialize their solver, i.e. before acado_feedbackStep(). This function is important enough that some implementations spawn dedicated threads to run it.

How do these concepts map to acados and its {{ model.name }}_acados_solve() function? Does the latter function carries out preparation and solving in one fell swoop?


in acados, the solve() function does not require a preparation by default.
It carries out the full SQP[-RTI] solve.

However, the acados SQP-RTI method does allow to split preparation and feedback phase. By setting rti_phase.
Here, rti_phase = 0; means full (preparation + feedback)
rti_phase = 1; means only preparation step
rti_phase = 2; means only feedback step


Great! Thank you. It does seem to me that fusing preparation and solve makes for a more intuitive interface.

For the sake of documenting the differences with ACADO, can I emulate acado_preparationStep() by

int preparation = 1;
ocp_nlp_solver_opts_set(cfg, opt, "rti_phase", &preparation);

and likewise emulate acado_feedbackStep() by setting rti_phase to 2 then calling solve()?

By the way, do you make use of OpenMP parallelization to speed up the preparation phase and obviate the need for separate preparation?