Symmetric slack

Dear ACADOS developers,

While staring at the general problem formulation (,
I was wondering if (and how) you could encode a double-sided constraint with a single slack…
In other words, how can I enforce the upper and lower slack to be equal?

Best regards,

Hi Joris,

Unfortunately, this is not possible.
acados uses the QP formulation of HPIPM, which encodes the QP in this way, i.e. each soft constraint (upper&lower) has its own slack variable.


As Jonathan already mentioned, you cannot do that by means of the slack variables functionality provided by the QPs in HPIPM, which are then inherited in acados.
The new encoding idxs_rev would allow for a single slack per stage for all lower constraints, plus another single slack for all the upper constraints, but the IPM solver currently requires one slack per single lower constraint, and same for upper (as it was designed for a different encoding idxs).
In any case, even the new encoding itself does not allow to have the same slack for upper and lower constraints.

Obviously you can do that by modeling yourself the slacks as extra inputs as you would do in a solver not supporting slacks as a special variable type.
Related to that, currently in acados the only QP solver able to natively handle slack variables is HPIPM itself.
In the case of all other solvers the slack variables are anyway transformed into extra input variables by the acados wrapper to the QP solver.

Thank you both for clarifying. We will indeed keep using control inputs as suggested by @giaf

Best regards,