# ANN: upcoming refactoring of JuMP's nonlinear API

**URL:** https://discourse.julialang.org/t/ann-upcoming-refactoring-of-jumps-nonlinear-api/83052
**Category:** Optimization (Mathematical)
**Tags:** jump
**Created:** [June 20, 2022, 7:25am UTC](https://discourse.julialang.org/t/ann-upcoming-refactoring-of-jumps-nonlinear-api/83052 "2022-06-20T07:25:06Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)
#### Post date: [June 20, 2022, 5:45pm UTC](https://discourse.julialang.org/t/ann-upcoming-refactoring-of-jumps-nonlinear-api/83052/6 "2022-06-20T17:45:24Z")

</div>

> [@ChrisRackauckas](#):
>
> So you can swap AD backends, but it still needs to be something

Each AD gets given the full expression graph, along with callbacks for how to numerically evaluate the function, gradient, a hessian of each operator. Then they have to produce a `MOI.AbstractNLPEvaluator` which implements the MOI callbacks like `eval_constraint_jacobian` and `MOI.hessian_lagrangian_structure`.

We have a few implementations already which gives us confidence this is a reasonable thing to do:

- The `SparseReverseAD` in JuMP
- `SymbolicAD` in [GitHub - odow/MathOptSymbolicAD.jl](https://github.com/odow/SymbolicAD.jl), which uses Symbolics.jl to compute sparse derivatives, but which uses some tricks to avoid computing the symbolic derivative of the full problem
- `MadDiff`: [GitHub - sshin23/MadDiff.jl: An automatic differentiation and algebraic modeling package](https://github.com/sshin23/MadDiff.jl)

For @ccoffrin’s [AC-OPF problems](https://discourse.julialang.org/t/ac-optimal-power-flow-in-various-nonlinear-optimization-frameworks/78486), SymbolicAD is 3-5x faster than `SparseReverseAD`, but on other problems it can be much worse.

---

_[View the full topic](https://discourse.julialang.org/t/ann-upcoming-refactoring-of-jumps-nonlinear-api/83052)._
