-
Notifications
You must be signed in to change notification settings - Fork 37
Add availability flags in NLPModelMeta and NLSMeta #525
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
base: main
Are you sure you want to change the base?
Conversation
tmigot
left a comment
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.
So, the implementation of NLPModels should set one of this flag to false is something is not implemented. We should also document it somewhere, if no obvious place in the NLPModels doc maybe the docstrings of the function to implement.
What is the motivation for this? Is that automatic solver selection ?
In ADNLPModels, it can even be automatic by checking whether EmptyADBackend is mentioned.
|
@tmigot The motivation is here: #524 (comment) |
|
The main issue is that is more models than before can't implement all the API (NN models, Oracle in MOI) and the solvers like |
Too much specific, we don't want to have The idea of |
|
Filling the attributes in the meta can be handled differently by the different implementation of nlpmodels. For most, it will be manually put, but ADNLPModels ca ba automatic. It does not add dependencies to adnlpmodels later on. |
|
Yes, I agree. |
I think it should be in the docstrings of the function, users will know that |
If you don't do it in this PR, please open an issue about it, thanks! |
330bdad to
99fc709
Compare
Done, I added references everywhere in the docstrings and documentation. |
Add flags in
NLPModelsMetaandNLSMetato specify whether gradient, sparse Jacobians, sparse Hessians, and operator-based products are available in a model.In some models, we do not want to, or cannot, implement the complete
NLPModels.jlAPI.Examples:
ADNLPModels.jl: we do not want to set up some AD backends if they are not needed (see issue Disable gradient and Hessian backends for NLSModels (part 2) ADNLPModels.jl#360).NLPModelsJuMP.jl: the user can specify from JuMP which subset of derivatives is needed, and the newVectorNonlinearOraclestructure in MOI does not support operator–vector products.AbstractNLPModelimplementations: at Argonne, we have some models involving neural networks where only the gradient is available (cc Sarah).This is an issue for solvers, because solvers such as
MadNLP.jlorMadNCL.jlexpectjtprodto be implemented but cannot easily know whether it is available before calling it.A similar issue occurs with
UnoSolver.jl, which relies on the BQPD subsolver by default and requireshprod.The absence of the Lagrangian Hessian can also help solvers like
NLPModelsIpopt.jlorNLPModelsKnitro.jlto automatically switch to quasi-Newton approximations.Using these new attributes also helps an oracle choose the most appropriate solver, and ensures that a clean error is returned when a solver cannot be used with a given model (
JSOSuite.jl?).This is preferable to triggering a missing method error.
This addition should be non-breaking (the full API is considered available by default) and should resolve a number of issues in dependent packages.