Hi all
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.
Hi,
you can interact with the solver using the get
, 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.
Cheers!
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.
Exactly!
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 :)).
Hey
I just made a PR on that!
Hope it helps you!
Hey @agazar
I am trying to implement the chance constrained Non Linear MPC and I would like to know more about how did you formulate the cost and the expected values in acados (if you used these approximations, of course).
The approach I found for NLMPC was using polynomial chaos expansion, but if you used another technique, it would also help me a lot!
Thanks
hey @Joaopdn ! sorry just saw your message. The expected cost is simply the Linear/Nonlinear least square cost (depending on your problem) of the mean your trajectory, and you take care of the chance-constraints back-offs design a long your horizon based on the propagated Gaussian covariances uncertainties through the linearized dynamics at each SQP iteration. Here is what I did before in detail (not in ACADOS), but currently, I am doing more or less the same with ACADOS for a stochastic nonlinear mpc: