-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Nonlinear] add new submodule #1804
Conversation
I discussed this with @matbesancon, and we decided that that easiest way forward is to make a new NonlinearOptInterface package, to merge this code into that, and then for JuMP to (temporarily) depend upon NonlinearOptInterface.jl. That lets us break things at will, and we can make small PRs without having to manage this stack (GitHub should make it easier to manage stacked PRs). |
Wouldn't working on branches of MOI and JuMP accomplish the same goal? You can submit PRs against branches. |
It can be a bit harder to keep track of a separate branch all the time. A separate repo can also work better to |
Okay, I've done quite a large refactoring. We now have model = Nonlinear.Model()
# add expressions, constraints etc.
evaluator = Nonlinear.Evaluator(model, Nonlinear.ExprGraphOnly(), [x])
block = MOI.NLPBlockData(evaluator) I think that makes the distinction a lot clearer, because |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The refactor is a big improvement.
Ok to merge or split off into a package (as you prefer). IMO it should be manageable to keep working within the MOI package using branches as needed.
You mean merge into MOI proper? Or squash these commits and then leave it as a long-running branch that we merge other PRs into? |
I don't see the harm in merging into MOI |
The other argument for having this in a separate package is keeping compilation time at a reasonable level, since one might change this one often in some cases without touching the rest of MOI. Having separate packages means separate compilation units |
Trying to see what this would give in the future, I guess we could have function Nonlinear.set_objective(model, expr)
func = Nonlinear.parse_expression(model, expr)
MOI.set(model, MOI.ObjectiveFunction{typeof(obj)}(), func)
end
function Nonlinear.add_constraint(model, expr, set)
expr = parse_expression(model, expr)
MOI.add_constraint(model, func, set)
end so these functions would provide a convenience API for providing expressions with the |
There is a warning at the top-level of the Nonlinear doc that anything in there is experimental and subject to breaking changes. We could add a statement in a docstring attached to the |
Doc is helping but I don't know if that's sufficient, might be though, just think we should consider both possibilities. |
I'll add a docstring. No one is going to be messing with this submodule accidentally. The docs are pretty clear that it is experimental, so I don't mind breaking things at-will for the near-term. |
The majority of this development was carried out in the JuMP PRs: * jump-dev/JuMP.jl#2939 * jump-dev/JuMP.jl#2942 * jump-dev/JuMP.jl#2943 Nonlinear.ReverseAD is a minor refactoring of code that previously existed in JuMP under the _Derivatives submodule, and prior to that the ReverseDiffSparse.jl package.
* Rename types to remove Nonlinear prefix * Split NonlinearData into Model and Evaluator * Remove set_differentiation_backend
At attempt to make #1803 more reviewable.
TODO before merging:
@amontoison