Hi guys

I am trying to add slack variables to my OCP and I just would ask you some clarification.

My OCP have 2 state and 1 input. I want to add

- a slack variable on the linear constraint on the first state x1 (construct by using the matrrix ‘Jsbx’).
- a slack variable on the NONlinear constraint on the control input u (construct by using ‘constr_expr_h’).

Leaving out the Mayer term this is what i set:

s_x = 10; % Weight for x1 slack variable

s_u = 50; % Weight for u slack variable

Z = diag([s_x;s_u]);

z = zeros(2,1);

Jsbx = 1;

Jsh = 1;

What it is not so clear for me is: what is the order to fill the weight matrix Z? The first element of Z, which slack variable corresponds to? There is an order in which slack variables are stacked? (for example firstly eventual slack on linear constraints on state, then on input and finally on nonlinear constraints)

Have a nice day,

Giulio