You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
It would be nice to have autodiff:
Some NLP solvers need you to pass the gradient and Hessian.
Some users might want to include the gradient as a constraint (See Global optimization of nonlinear least-squares problems by branch-and-bound and optimality constraints, Sahinidis et al., 10.1007/s11750-011-0178-8)
I am also considering using num_dual (Pros: works outside of nightly, Cons: Probably worse performance) and symdiff (this one is symbolic, closer to Pyomo than JuMP).
While I'm not focused on performance right now, I think a nightly crate is acceptable and the way forward. Plus, not all of the users will require it, since many solvers handle derivatives themselves.
I've been working on this issue.
I think std::autodiff is the way to go, and I have written a lot of code with it, using forward-over-reverse mode. The API is quite nice.
As for N° 2, I don't think we can do exactly this using autodiff. We would need symbolic expressions.
For now, I think the way to go is to provide autodiff for the solvers that need it and an API to perform linearization using a first-order Taylor approximation for these uses.
I think that, in the end, we should offer two crates:
oximo-autodiff (this work, using std::autodiff + linearization for now)
oximo-symdiff (symbolic differences)
However, I am not sure symdiff is the right approach for this use case.
One option is symb_anafis.
Another option, which I really like, is Symbolica, however the license seems like a no-go:
FAQ:
Whether end users need a license is decided on a case-by-case basis. In most situations, when Symbolica is only a small part of the API exposed to your users, they do not need a separate license to run your program with multi-core or multi-instance support.
Activity
GermanHeim commentedon Jun 11, 2026
I've been working on this issue.
I think std::autodiff is the way to go, and I have written a lot of code with it, using forward-over-reverse mode. The API is quite nice.
As for N° 2, I don't think we can do exactly this using autodiff. We would need symbolic expressions.
For now, I think the way to go is to provide autodiff for the solvers that need it and an API to perform linearization using a first-order Taylor approximation for these uses.
I think that, in the end, we should offer two crates:
However, I am not sure symdiff is the right approach for this use case.
One option is symb_anafis.
Another option, which I really like, is Symbolica, however the license seems like a no-go:
So I will need to ask around!