Thanks a lot for creating such a nice library :)). I am currently using the python API to run a stochastic nonlinear optimal control problem with chance constraints. For the deterministic reformulation of the chance constraints, I need to update some parameters (like sensitivities and some jacobian function) inside those constraints evaluated at every SQP Linearization point. what is the right way to do this in
acados in an automatic fashion? Thanks for your help.
you can interact with the solver using the
set functionalities in between solver iterations.
This way you can update parameters, bounds and matrices for general linear constraints.
If you want to interact with it faster, you can use C.
One idea to make this more convenient is to add a custom function in C in the template workflow that can be called conveniently between SQP RTI iterations. But I did not do this yet.
Thank you for your reply. Just to confirm that I understood you correctly. This means I can’t do this update automatically inside my constraint (yet). Meaning I need to create an outer SQP iteration loop where I solve RTIs inside the loop, get the quantities I need from the solver, update my constraints based on the solution of the current iterate and resolve. Finally adding the stopping criteria manually, does that make sense?
Yes, if you don’t find a way to express such updates in the constraint function.
update: I have tried the above and it works nicely as a work around (at least for prototyping purposes), thanks a lot for the suggestion :)).
@FreyJo may you guide me through an example in the code, where I can implement my functions in C in the template workflow to run things automatically during the SQP iterations? This will be useful for me especially for real-time control. I also would like to be able to call those functions in python as well- thanks :)).
I just made a PR on that!
Hope it helps you!