Changing constraints and bounds on slack variables

Hi :wave:

I am currently using acados for a MPC formulation. In my formulation I want to alter the bounds on my slack variables. I am using acados in Python3.

My system is in discrete time.

For example, I predict 40 time steps, and in time steps 20-25, I want to set the bounds on my slack variables to 0, in all other time steps, I set them to a fixed value, say, 10^6.
Is this possible in acados?

In the documentation there is the api constraints_set, but this does not allow to set the bounds of the slack variables, for example ush.

Hi :waving_hand:

Just to clarify: are you trying to switch between hard constraints (slack needs to be zero) and soft constraint (slack can take any positive value)?

Best, Katrin

Hi Katrin,

Thank you for the swift reply.

Yes, that is what I want to do. I want for some stages the nonlinear constraint h to be a soft constraint while for some other stages to be a hard constraint.

Kind regards,
Peter Karstensen

Hi Peter, this can be implemented via a multi-phase formulation. The main idea is to specify multiple OCPs, one for each phase, and specify which shooting nodes belong to which phase. In your example, you will need three phases, node 1 to 19, node 20 to 25, node 26 to 40.

Here is an example that illustrates how to formulate MOCPs:

and hereโ€™s our recent publication introducing MOCPs in acados.

Best, Katrin