Add State Upper Bound Constraints with Slack Variables in Acados

Hi :wave:
I’m trying to add constraints on the states in Matlab and have a question. I have 6 state variables: [X1, X2, X3, X4, X5, X6], and I want to impose the following three constraints with slack variables:

  1. X3<100
  2. X4<100
  3. X5<100
    To implement this in Acados, can I use the following settings?

Code
AcadosConstraints.idxbx = [2, 3, 4];
AcadosConstraints.idxsbx = [2, 3, 4];
AcadosConstraints.ubx = [100, 100, 100];
AcadosConstraints.lbx = -[ACADOS_INFTY, ACADOS_INFTY, ACADOS_INFTY];

Best regards,

Hi Anthony,

the slack indices need to be defined relative to the constraint indices, i.e. in your case you would need idxsbx = [0, 1, 2].

Best, Katrin

Thank you for your answer! :grinning_face: :grinning_face: