-
Notifications
You must be signed in to change notification settings - Fork 37
Add availability flags in NLPModelMeta and NLSMeta #524
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
|
|
@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) |
Yes, you will be able to specify more keyword arguments. |
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