I’m currently trying to get more insights into my optimal control problem and why the solution looks like it does. Specifically, I’m wondering how I can see what constraints are active and which are not. Is there a simple way of doing this? Just looking at the output of the solver when increasing the verbosity flag is not the most insightful information, frankly.
Particularly, I’m curious about evaluating the nonlinear constraints and/or transition function at the state/inputs of my solution using the C-interface.
I have found the following functions, which seem relevant, but I could not figure out how to use them:
Specifically, I’m wondering how I can see what constraints are active and which are not. Is there a simple way of doing this?
One way would be to check the multipliers, an inequality multiplier which is (numerically) bigger than zero indicate that the corresponding constraint is active.
If you want to evaluate the nonlinear constraint h externally, this can indeed be done calling
my_solver_name_constr_h_fun
This boils down to calling a CasADi generated function in C.
Unfortunately, I don’t have a good reference for this right now.
One thing that I agree would be very useful is to add a get functionality for the full inequality residual at a given shooting node. Right now, one can only get the max norm of the residual over all inequalities, which gives not much insight on which constraints are violated.
Unfortunately, I don’t have a good reference for this right now.
That’s too bad. I will make an update in case I can get this running.
One thing that I agree would be very useful is to add a get functionality for the full inequality residual at a given shooting node. Right now, one can only get the max norm of the residual over all inequalities, which gives not much insight on which constraints are violated.
Yes, that would be pretty helpful. I have to see whether I maybe find some time in the future to start working on this.