# JuMP: unused \`@operator\` has critical impact

**URL:** <https://discourse.julialang.org/t/jump-unused-operator-has-critical-impact/136895>\
**Category:** Optimization (Mathematical)\
**Tags:** jump, infiniteopt\
**Created:** [April 27, 2026, 5:07am UTC](https://discourse.julialang.org/t/jump-unused-operator-has-critical-impact/136895 "2026-04-27T05:07:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cstjean](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cstjean/32/1444_2.png) [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Post date:** [April 27, 2026, 5:07am UTC](https://discourse.julialang.org/t/jump-unused-operator-has-critical-impact/136895/1 "2026-04-27T05:07:34Z")

</div>

I have some model defined like

```julia
fake_fun(a,b) = 0

function my_model()
    ...
    @operator(m, unused_op, 2, fake_fun)  
    ...
end

```

where both `unused_op` and `fake_fun` are not used anywhere except on that line. With this `@operator` line, Ipopt swiftly optimizes my (InfiniteOpt) models (in less than 5 seconds). However, if I change it to

```julia
fake_fun(a) = 0

function my_model()
    ...
    @operator(m, unused_op, 1, fake_fun)  
    ...
end

```

or if I take out that line altogether, then the process becomes unresponsive (unkillable) and I see this message:

```julia-auto
MUMPS returned INFO(1) = -9 and requires more memory, reallocating. Attempt 1
  Increasing icntl[13] from 1000 to 2000.

```

Furthermore, I have noticed that `Number of nonzeros in Lagrangian Hessian` goes from 0 to:

```julia-auto
Number of nonzeros in equality constraint Jacobian...: 7842
Number of nonzeros in inequality constraint Jacobian.: 0
Number of nonzeros in Lagrangian Hessian.............: 11625

```

when I take out the `@operator` line.

Is that a bug that deserves a MWE, or is that “Well, Ipopt has a number of heuristics, and one of those changes when an `@operator` is present”?

---

<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:** [April 27, 2026, 5:24am UTC](https://discourse.julialang.org/t/jump-unused-operator-has-critical-impact/136895/2 "2026-04-27T05:24:54Z")

</div>

> However, if I change it to

I think you might be missing something. They look the same to my eyes. I’m guessing you meant `#@operator`.

> [@cstjean](#):
>
> Well, Ipopt has a number of heuristics, and one of those changes when an `@operator` is present

It’s this one. Except it isn’t really the fault of Ipopt.

The issue is in MathOptInterface’s sparse reverse-mode automatic differentiation backend: if you have a multivariate user-defined operator and you do not provide an explicit oracle for the Hessian, then MOI disables the Hessian of the Lagrangian:

> <https://github.com/jump-dev/MathOptInterface.jl/blob/06ed375d1227e657c4844a1b81c9fe9656b4049e/src/Nonlinear/ReverseAD/mathoptinterface_api.jl#L10-L20>

In Ipopt, this means it sets the `hessian_approximation=limited-memory` option:

> <https://github.com/jump-dev/Ipopt.jl/blob/901e2be23a23aaa428985684bc8d607c327f47bc/ext/IpoptMathOptInterfaceExt/MOI_wrapper.jl#L1340-L1345>

So if you do `set_attribute(model, "hessian_approximation", "limited-memory")` then you should be able to remove the `@operator` and it will still be fast.

---

<div class="post-metadata">

**Author:** ![cstjean](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cstjean/32/1444_2.png) [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Post date:** [April 27, 2026, 5:45am UTC](https://discourse.julialang.org/t/jump-unused-operator-has-critical-impact/136895/3 "2026-04-27T05:45:25Z")

</div>

Thank you, that’s what I suspected. It worked!
