Skip to content
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

Simplify handling of linear and quadratic derivatives for nonlinear solvers #1397

Closed
blegat opened this issue Jun 19, 2021 · 5 comments
Closed
Labels
Project: next-gen nonlinear support Issues relating to nonlinear support
Milestone

Comments

@blegat
Copy link
Member

blegat commented Jun 19, 2021

The wrappers of nonlinear solvers like Ipopt and NLopt are quite complicated because the solvers only expect gradient, jacobian, hessian callbacks and they also support linear and quadratic objective and constraints.
We cannot rewrite them with bridges since bridges do not play well with the NLPBlock.
This will be resolved by #846 but in the short term, it would be good to have a solution as well.
We could create an MOI layer (that would be a copy-paste of part of the Ipopt wrapper basically) that would do the transformation.
Now how do we add this MOI layer in JuMP for nonlinear solvers ?
Similarly to jump-dev/JuMP.jl#2610, the MOI layer would be automatically added by JuMP if it detects that a linear/quadratic constraints is not supported even when adding bridges but the solver supports NLPBlock.

@odow
Copy link
Member

odow commented Jun 19, 2021

I think this is out-of-scope for MathOptInterface 1.0.

There are only a handful of solvers that need this, and they are already implemented. The Ipopt.jl wrapper could do with a large refactoring, but that could happen post MOI 1.0.

Let's focus on finishing what we have, rather than adding yet more complexity.

@blegat
Copy link
Member Author

blegat commented Jun 20, 2021

I think doing this would in fact decrease complexity quite a lot. Maintaining this MOI layer and simpler NL solver is much easier than maintaining MOI wrappers that are so complicated. I don't think a refactoring of Ipopt.jl would help, the wrapper is written quite well it's just doing too many things. Also, this is currently a big blocker for adding support for more NL solvers since writing the MOI wrapper go so much more complicated with MOI compared to MPB where you didn't have to support affine and quadratic.

I don't think it's blocking the release of MOI v0.10 or MOI v1.0 though as it's non-breaking but I might do this to ease the addition for new MOI wrappers for NL solvers I need.

@odow
Copy link
Member

odow commented Jun 20, 2021

This could be a separate package first. It's really one of these "model transformers" we have been talking about.

  • Dualization.jl: model -> dual
  • Complementarity.jl: model + Complements -> MILP or nonlinear approximation
  • Hypothetical Nonlinear: nonlinear model + linear/quadratic -> Pure nonlinear model
  • Hypothetical Presolve: model -> presolved equivalent

@odow odow added this to the Nonlinear Rewrite milestone Jun 21, 2021
@odow odow added the Project: next-gen nonlinear support Issues relating to nonlinear support label Apr 13, 2022
@odow odow added the Submodule: Bridges About the Bridges submodule label May 24, 2022
@odow odow changed the title Nonlinear bridges Simplify handling of linear and quadratic derivatives for nonlinear solvers Jun 14, 2022
@odow odow removed the Submodule: Bridges About the Bridges submodule label Jun 14, 2022
@odow odow modified the milestones: v2.0, v1.x Jun 14, 2022
@odow
Copy link
Member

odow commented Jul 18, 2022

jump-dev/Ipopt.jl#320 adds a QPData type with overloads that solves this.

@odow
Copy link
Member

odow commented Sep 12, 2023

We now have bridges from ScalarAffine and ScalarQuadratic to ScalarNonlinearFunction, so solvers who don't exploit linear/quadratic functions are much simpler.

If solvers do exploit, then they'll need specialized support anyway. One option is to copy the code from Ipopt. I don't know if we need to add yet-another-utility to MOI for this.

I propose to close this issue unless anyone objects.

@blegat blegat closed this as completed Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Project: next-gen nonlinear support Issues relating to nonlinear support
Development

No branches or pull requests

2 participants