Add availability flags in NLPModelMeta and NLSMeta#524
Closed
amontoison wants to merge 5 commits intomainfrom
Closed
Add availability flags in NLPModelMeta and NLSMeta#524amontoison wants to merge 5 commits intomainfrom
amontoison wants to merge 5 commits intomainfrom
Conversation
Contributor
Member
Author
|
|
@amontoison Does this mean my initialization of meta = NLPModelMeta(Lux.parameterlength(Slr.Diag.CNNVars.model_Su) + Lux.parameterlength(Slr.Diag.CNNVars.model_Sv);
ncon=0,
nnzh=0,
x0=param_guess,
lvar=lvar,
uvar=uvar,
**gradient_available=true**,
**hessian_available=false**
)where I've highlighted the changes with ** (bold doesn't seem to be available in code blocks) |
Member
Author
Yes, you will be able to specify more keyword arguments. |
Member
Author
|
Done in #525 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
We still need to address #523, since these flags cannot be used consistently across the ecosystem until the full migration to 0.22 (which may take months given the number of dependent packages).
I expected it to land in a patch release of
0.21.x.cc @frapac @sshin23 @swilliamson7 @cvanaret @odow