Dear Joris,
I tried posting [here](
https://groups.google.com/g/casadi-users/c/N1LnJcDX7q0) firt a few days ago and am still struggling with this.
what if we want to add a slack variable through the C++ API with an equality constraint?
e.g., starting with something like
x_k = x0;
adding a slack constraint
g.push_back(x_k + s_k);
g_min.insert(g_min.end(), x0.begin(), x0.end());
g_max.insert(g_max.end(), inf.begin(), inf.end());
where
std::vector<double> inf = {casadi::inf};
then on the other side
g.push_back(x_k - s_k);
g_min.insert(g_min.end(), neg_inf.begin(), neg_inf.end());
g_max.insert(g_max.end(), x0.begin(), x0.end());
where
std::vector<double> neg_inf = {-casadi::inf};
then bound s_k to be greater than zero and add it to the cost functional.
would it be something like this? Is this approach sound?
I tried this and I am getting "feasible" solutions where
x0 < x_k + s_k // where for instance the values might be 0.5 < 0 + 0 , where x_k and s_k are the optimized variables.
I assume that I have made a mistake somewhere, is there a way to print out the constraint equations? I turned up the print to 12 on IPOPT, but do not see any equations, I think I remember seeing something like this in the Python API.
Thanks!