OCP solver re-initialization - weird slack behavior

Hi :wave:

I’m using the matlab interface for acados to set up an acados_ocp object to solve different problems by changing parameters, e.g., changing time-varying constraints. Doing so, I’ve noticed that the solver does not behave as I would expect. I’m using sqp_rti with HPIPM as a QP solver.

Example: I want to use one acados_ocp object to solve two OCP problems using the same initial conditions and trajectory initial guesses, but different parameters. The first one is infeasible, the second one is feasible. I formulate slack variables on the constraints to ensure that the QPs are feasible.

By running the following steps in pseudo code below

ocp = create_ocp_object()
ocp.set('p',parameters1)
opc.solve() # this problem formulation is infeasible (expect active slack variables)
ocp.get('slacks')
#
ocp.set('p',parameters2)
opc.solve() # this problem formulation is feasible (expect inactive slack varibles)
ocp.get('slacks')

the first problem returns slack variables that I expect to see, i.e., I see active slack values. However when I solve the other one it seems that I get the difference in slack variables, rather than the actual ones for the problem, please see the figures attached.

Question: Do the matlab commands ocp.get('sl',stage) and ocp.get('su',stage) return the actual slack value or the change in slack value? Am I doing something wrong, or is this perhaps some unwanted behavior?

Link to minimum working example on: https://github.com/ivobatkovic/acados-slack-example

Thanks,
Ivo

Hi Ivo,

Thanks for reporting this, that was actually a bug in the interfaces!
I just pushed a fix, see this commit:

It is merged into the acados/master branch.

Cheers!

1 Like