# How to save nonlinear JuMP model to file?

**URL:** <https://discourse.julialang.org/t/how-to-save-nonlinear-jump-model-to-file/86322>\
**Category:** Optimization (Mathematical)\
**Tags:** jump, nlp\
**Created:** [August 25, 2022, 12:28pm UTC](https://discourse.julialang.org/t/how-to-save-nonlinear-jump-model-to-file/86322 "2022-08-25T12:28:43Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![SteffenPL](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/steffenpl/32/206270_2.png) [@SteffenPL](https://discourse.julialang.org/u/SteffenPL)\
**Post date:** [August 25, 2022, 4:02pm UTC](https://discourse.julialang.org/t/how-to-save-nonlinear-jump-model-to-file/86322/2 "2022-08-25T16:02:00Z")

</div>

Since there is no answer yet. It could be quite likely that this is just not possible. In linear cases, the interface can store the internal representation of the linear/quadratic terms. For nonlinear terms, the interface would need to be able to store an arbitrary Julia function. Which is of course much harder.

I think the question then becomes: If you have a very long and complicated function, is it maybe easier to put it into a Julia file and store this script (and include it later again) rather than some serialization which might not work in the future?

If your nonlinear function is a symbolic expression, you could use Symbolics to store it: [Symbolic Calculations and Building Callable Functions · Symbolics.jl](https://symbolics.juliasymbolics.org/stable/tutorials/symbolic_functions/#Building-Functions-1) They also use the approach to store a Julia file with the plain definition. (See this recent post: [Using Serialization to store then load a lambdified function? - #4 by SteffenPL](https://discourse.julialang.org/t/using-serialization-to-store-then-load-a-lambdified-function/85884/4) but there are more posts of course on this topic.)

---

_[View the full topic](https://discourse.julialang.org/t/how-to-save-nonlinear-jump-model-to-file/86322)._
