peterdsharpe / AeroSandbox

Aircraft design optimization made fast through computational graph transformations (e.g., automatic differentiation). Composable analysis tools for aerodynamics, propulsion, structures, trajectory design, and much more.
https://peterdsharpe.github.io/AeroSandbox/
MIT License
754 stars 123 forks source link

Is it possible to provide the gradient and Hessian matrices by user? #145

Open Zcaic opened 1 month ago

Zcaic commented 1 month ago

I found there is blackbox to define user function, but the gradient is get by finite difference. If I have gradient info, even Hessian information, can I offer these informations to blackbox ?

cdhainaut commented 1 month ago

Quick answer is yes. Although I think this is a more CasADi (the underlying AD lib that uses AeroSandbox) related topic. You should have a look at CasADi Callback class. Some ressources: https://web.casadi.org/docs/#sec-callback https://github.com/casadi/casadi/blob/main/docs/examples/python/callback.py