tl;dr:
The next feature release of JuMP (probably v1.2.0) introduces a large
refactoring of JuMP’s nonlinear API. If you have code that accessed private
features of the nonlinear API, such as JuMP._Derivatives
or model.nlp_data
,
your code will break. If you used only the public, documented API such as
register
, @NLconstraint
and num_nonlinear_constraints
, this change does
not affect you. To try the uncoming release, use
import Pkg; Pkg.pkg"add JuMP#od/moi-nonlinear"
, then restart Julia for the change to take effect.
The relevant pull request is Refactor to use MOI.Nonlinear by odow · Pull Request #2955 · jump-dev/JuMP.jl · GitHub
What are we doing?
Over the last few months, we have been refactoring how JuMP supports nonlinear
programs. This involved moving and re-organizing a large amount of code from
JuMP into MathOptInterface.
The result is the new MOI.Nonlinear
submodule in MathOptInterface, with a
documented public API for creating and dealing with nonlinear programs. Read
more about it here: Overview · MathOptInterface
However, as part of this work we are removing code from JuMP. This code was
internal, undocumented, and not intended for public use. Most of it was
contained in the JuMP._Derivatives
submodule, but we also made changes such
as removing model.nlp_data
.
Why did we do this?
The nonlinear code in JuMP was a clear example of technical debt. It was
complicated, convoluted, and largely undocumented. People wanting to extend JuMP
for nonlinear programs were forced to use a range of hacks that relied on
undocumented internals.
The new MOI.Nonlinear
submodule offers a stable, documented, and public API
for people to build JuMP extensions on. It also enables new features like
swappable automatic differentiation backends, and hessians of user-defined
functions.
We originally considered that any change in the nonlinear API would be a
breaking v2.0.0 release of JuMP and occur at least two years after the release
of JuMP 1.0. However, we implemented the changes quicker than expected, and we were
able to do so in a way that does not break the public nonlinear API. Therefore,
we elected to classify this as a non-breaking feature release.
Does it affect me?
If you have any code that called private features of the JuMP nonlinear API,
such as JuMP._Derivatives
or model.nlp_data
, your code will break.
If you used only the public, documented API such as register
, @NLconstraint
and num_nonlinear_constraints
, this does not affect you.
What are the next steps
Try the uncoming release as follows:
import Pkg; Pkg.pkg"add JuMP#od/moi-nonlinear"
.
If you find any bugs or changes in performance, please post below, or open a
GitHub issue. Once we’re happy that there are no issues with the changes, we
will merge the pull request, and then release a new version of JuMP with the changes.