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

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), 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 but I’m not sure if this could be relevant in my case).

Thanks for the help.