Slack variables definition

Hi,
I’m trying to add some slack variables to my MPC problem and I have a doubt.
I’ll make an example to explain it.

I have 4 states: [x1, x2, x3, x4], and I want to implement 3 constraints:

  1. x2 < 1
  2. x3 < 1
  3. x2 - s < 0

How do I set the AcadosConstraints.idxbx and AcadosConstraints.idxsbx?

My guess is:
AcadosConstraints.idxbx = [2, 3, 2];
AcadosConstraints.idxsbx = [3];

Am I right?

Thanks

Samuele

Hi Samuele,

the idx* fields are all 0-based, so idxbx should be idxbx=[1, 2, 1]. The field idxsbx is zero based as well and the indices are also relative wrt. idxbx, so you need idxsbx= [2].

Best, Katrin

1 Like