Hello, I’ve faced some problems.
First of all, I have no idea how to call generated solver from python script without regenerating the solver.

The other problem is in fact, that I can’t reinitialize solver \ set to initial state (just like after generation)?
It would be grate if anybody could help me.

for resetting you can do store_iterate() right after the creation and then do load_iterate().
Those routines load (and store) the initial guess (iterate) of the SQP method.

Thanks for your replay. I saw no problems with c++ implementation (by using C interface). I’ll the trick described by you. I hope it will help me to reset a solver in python interface.

UPD: It really works. If you call store_iterate() just after the solver was created and use load_iterate() before each solver call, the solver will backup to the stored state. It’s a bit unintuitive but works just great_)

do you know if we could implement this in the Simulink S-Function implementation?
During running online on an engine, this would be really helpful. Otherwise, you need to restart the engine RCP controller every time, e.g. the MABX from dSPACE.

for now the Sfunction has the option to be generated with the fields x_init and u_init.
It would be straight forward to add similar fields for the multipliers.
Then you could just pass zeros for those fields to reset the solver.

Do you think that would work?
An S Function block is not as flexible as a Python class.
The latter has different member functions solve(), load_iterate(), …
S Functions could maybe call some reset functionality based on a flag though.
We can talk about this more once I am back at the university.
But feel free to mess with the Simulink interface!

thanks for your answer.
So I guess I would have to add “lam” and “pi” inputs / setter in the ocp_create.c (interface/acados_matlab_octave), simulink_deafult_opts.json and in the acados_solver_sfun.in.c (interface/acados_templated/c_templates_tera)?
Would that be it?

Thanks for your offer, I will come back to it for sure!

i have same problem like you
but i can’t understand where to put store_iterate() and load_iterate() function in my code
can you share the example code which you use above functions

You may put store_iterate() just after you’ve created the solver and use load_iterate() right before the solver is calling (Be aware to use load_iterate before you initialize the solver with your data, otherwise you will get empty problem).
In other words:
Fist step:
You create the solver
Use store_iterate()
Second step (whenever you think to call the solver):
You use load_iterate()
Initialize the solver
Call the solver