# JuMP, large expression, and hessian "limited-memory" option in Ipopt

**URL:** https://discourse.julialang.org/t/jump-large-expression-and-hessian-limited-memory-option-in-ipopt/112609
**Category:** Optimization (Mathematical)
**Tags:** question, jump
**Created:** [April 6, 2024, 3:22pm UTC](https://discourse.julialang.org/t/jump-large-expression-and-hessian-limited-memory-option-in-ipopt/112609 "2024-04-06T15:22:28Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![niro](https://avatars.discourse-cdn.com/v4/letter/n/bb73d2/32.png) [@niro](https://discourse.julialang.org/u/niro)
#### Post date: [April 8, 2024, 4:43pm UTC](https://discourse.julialang.org/t/jump-large-expression-and-hessian-limited-memory-option-in-ipopt/112609/3 "2024-04-08T16:43:48Z")

</div>

Thanks @odow for the answers. This clarifies my understanding.

Yes, I was aware of these optimal control packages in Julia. I tried them and it’s nice to see such developments, but I’m not sure that they would scale much better if the dynamics is a very large expression. I’ve read this post ([JuMP: Constraint with a huge expression](https://discourse.julialang.org/t/jump-constraint-with-a-huge-expression/108456)), where a similar issue is discussed.

I cannot give a MWE now but I can improve the description. Basically I do preliminary calculations using Symbolics.jl, use build\_function() before I switch to JuMP to formulate my optimal control problem. In the symbolic part, I essentially compute a Jacobian matrix, and solve a linear system to automatically build the f term in the system \dot{x} = f(x,u). This function f may be a huge expression with dozens of dimensions.

I managed to speed up the @expression line by adding subexpressions and variables in JuMP, but it requires splitting the problem in smaller pieces (typically I would generate a function for the Jacobian matrix, and others for the right and left hand-sides of the linear system to avoid solving it (that is, adding a constraint like Ax=b rather than x=A\b). It does speed up the building of the JuMP model but Ipopt convergence is less good in general (perhaps because there are more unknowns in the resulting NLP).

For my problem, I was also wondering if there is a way to form a Jacobian expression from an existing expression in JuMP?  
(I’ve seen this post: [JuMP: use AD within a JuMP model to define a derivative-based constraint](https://discourse.julialang.org/t/jump-use-ad-within-a-jump-model-to-define-a-derivative-based-constraint/23085) but I’m not sure if this could be relevant in my case).

Thanks for the help.

---

_[View the full topic](https://discourse.julialang.org/t/jump-large-expression-and-hessian-limited-memory-option-in-ipopt/112609)._
