Example for formulating soft path constraints

Hi :wave:
I am using the C Interface of HPIPM (without ACADOS). I need to model 3 path constraints with corresponding soft constraints. Unfortunately I struggle to find a documentation on how to set up the formulation for the variable idxs.

for (unsigned int i{ 0 }; i < N + 1; ++i)
{
    ng[i] = 3;
    C[i] = [3x3]; // C Matrix defines the path constraints
    D[i] = [3x3]; // D Matrix defines the path constraints
    lg[i] = [..., ..., ...]; // lg defines the lower bounds on the path constraints
    ug[i] = [..., ..., ...]; // ug defines the upper bounds on the path constraints
    nsbu[i] = 0; // no slacks for control variables
    nsbx[i] = 0; // no slacks for state variables
    nsg[i]  = 3; // slacks for each of the three path constraints
    idxs[i]  = [???, ???, ???]; // HOW can I define this variable?
}

Thank you very much for your support.

All the best!!!
Fabian

Hi Fabian,

I think that the acados docu can be helpful.
Check this Python Interface — acados documentation

And the note here for the constraint order: Python Interface — acados documentation

In HPIPM, you just dont have the h and phi constraints.

Thank you very much for your reply.
The documentation of the python acados interface says:
idxs → Indices of soft nonlinear constraints within the indices of nonlinear constraints.

If I get it right, HPIPM does not have idxsbx, idxsbu, idxsg but just idxs which means I need to consider the order of the linear constraints while setting the indices?
I just found this example https://github.com/alexliniger/MPCC/blob/master/C%2B%2B/Interfaces/hpipm_interface.cpp#L180

Is the solution for my example then:

for (unsigned int i{ 0 }; i < N + 1; ++i)
{
    ng[i] = 3;
    C[i] = [3x3]; // C Matrix defines the path constraints
    D[i] = [3x3]; // D Matrix defines the path constraints
    lg[i] = [..., ..., ...]; // lg defines the lower bounds on the path constraints
    ug[i] = [..., ..., ...]; // ug defines the upper bounds on the path constraints
    nsbu[i] = 0; // no slacks for control variables
    nsbx[i] = 0; // no slacks for state variables
    nsg[i]  = 3; // slacks for each of the three path constraints
    idxs[i]  = [0 + (nbu[i] + nbx[i]), 1 + (nbu[i] + nbx[i]),  2 + (nbu[i] + nbx[i])];
}

The ordering is u, x, g ?

I guess there is no other way of formulating this OCP using the low level interface of HPIPM.

All the best :slight_smile: