Different nonlinear inequality constraints for each stage


I was wondering if you will include in ACADOS in the future the possibility to set different inequality constraints for each discretization node/stage. If I am not mistaken this is not feasible in ACADO or ACADOS and currently, if one sets an inequality constraint, it must hold for all discretized states. I was able to do this with CasADi of course and FORCES PRO.


Hi CT,

this is already possible from the C interface.
However, it is not possible from our higher level interfaces (Python, Matlab/Octave).
We want to extend these interfaces to a multi-phase formulation, but it is not a priority right now.

May I ask which of the interfaces you are using?

Also, do you really need completely different nonlinear constraint functions for the stages?
For example, it is already possible to use parametric constraint functions
and set the parameter values p for each stage individually.



Going through this again, I may have come off rude by simply labelling your answer as a solution and not answering your questions. I apologize if that is the case. I was using the python interface and both your suggested solutions work for me.

Thanks for your help,

1 Like

Hi FreyJo and ctoumieh,

I am new to acados and I am a Matlab user.
After looking through all the available examples I could not find a solution to the problem.

I do not know how to update the constrains for every stage.
Would you be so kind and explain it to me by a simple and small example how to update the constrains?

Best regards,

Hi Freddy!

Unfortunately, for the time being it is not possible to define optimal control problems with fully time varying constraints - apart from the fact that you can specify a different terminal constraint and cost. However, what you can do is to use a parameter that takes different values on every stage (see e.g https://github.com/acados/acados/blob/master/examples/acados_matlab_octave/wind_turbine_nx6/example_closed_loop.m#L396). Would that solve your problem?

Hello zanellia,

Thank you a lot for you answer, and sorry for my delay, but I had to get to know acados a bit beforehand.
i looked at the parameter and I already used it in my model dynamics.
I figured out, that in Simulink it is possible to change the state/input or nonlinear constraints while runtime.
Is it possible to do that in the Matlabcode in closed loop simulation as well?

Best regards,

Hi Christoph,

sure that is possible, you can do it like here: