Gradients for custom C functions

72 views
Skip to first unread message

Łukasz Juszkiewicz

unread,
Jul 1, 2019, 4:49:36 AM7/1/19
to CasADi
Hi,
I want to use BlockSQP solver with custom C/C++ objective and constraints functions (not really possible to rewrite them with symbolics). I successfully made it work using C++ Callback class. However, I'd like to use C function interface so I can use code generation. Problem is that I don't know how to properly define derivatives in case of external functions. Could you provide minimal example for that?

Best regards,
Łukasz Juszkiewicz

Joel Andersson

unread,
Aug 1, 2019, 8:32:57 AM8/1/19
to CasADi
I think that the main thing BlockSQP needs is the Hessian sparsity. In principle you can add that information to a wrapper using C++ and Callback. But I don't think it's worthwhile. You should really try to rewrite the dynamics using symbolics. Why can't you do that?

Joel
Reply all
Reply to author
Forward
0 new messages