-
Notifications
You must be signed in to change notification settings - Fork 9
Add DiagonalQNModel and SpectralGradientModel #94
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
Add DiagonalQNModel and SpectralGradientModel #94
Conversation
Codecov ReportBase: 92.31% // Head: 92.40% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #94 +/- ##
==========================================
+ Coverage 92.31% 92.40% +0.08%
==========================================
Files 6 6
Lines 859 869 +10
==========================================
+ Hits 793 803 +10
Misses 66 66
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
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.
That looks great, thanks @geoffroyleconte for the new feature. I just made a couple of comments to try solve the issues raised, and improve doc and tests.
julia> @code_warntype hess_op(nlp, x)
MethodInstance for NLPModels.hess_op(::DiagonalQNModel{Float64, Vector{Float64}, SimpleNLPModel{Float64, Vector{Float64}, NLPModelMeta{Float64, Vector{Float64}}}, NLPModelMeta{Float64, Vector{Float64}}}, ::Vector{Float64})
from hess_op(nlp::QuasiNewtonModel, x::AbstractVector; kwargs...) in NLPModelsModifiers at C:\Users\Geoffroy Leconte\.julia\dev\NLPModelsModifiers\src\quasi-newton.jl:155
Arguments
#self#::Core.Const(NLPModels.hess_op)
nlp::DiagonalQNModel{Float64, Vector{Float64}, SimpleNLPModel{Float64, Vector{Float64}, NLPModelMeta{Float64, Vector{Float64}}}, NLPModelMeta{Float64, Vector{Float64}}}
x::Vector{Float64}
Body::LinearOperators.DiagonalQN
1 ─ %1 = Core.NamedTuple()::Core.Const(NamedTuple())
│ %2 = Base.pairs(%1)::Core.Const(Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}())
│ %3 = NLPModelsModifiers.:(var"#hess_op#20")(%2, #self#, nlp, x)::LinearOperators.DiagonalQN
└── return %3 (Body is in red, but not displayed here on github). |
With my last commit: julia> @code_warntype hess_op(nlp, x)
MethodInstance for NLPModels.hess_op(::DiagonalQNModel{Float64, Vector{Float64}, SimpleNLPModel{Float64, Vector{Float64}, NLPModelMeta{Float64, Vector{Float64}}}, NLPModelMeta{Float64, Vector{Float64}}, LinearOperators.DiagonalQN{Float64, Int64, Vector{Float64}, LinearOperators.var"#84#85"{Vector{Float64}}}}, ::Vector{Float64})
from hess_op(nlp::QuasiNewtonModel, x::AbstractVector; kwargs...) in NLPModelsModifiers at C:\Users\Geoffroy Leconte\.julia\dev\NLPModelsModifiers\src\quasi-newton.jl:155
Arguments
#self#::Core.Const(NLPModels.hess_op)
nlp::DiagonalQNModel{Float64, Vector{Float64}, SimpleNLPModel{Float64, Vector{Float64}, NLPModelMeta{Float64, Vector{Float64}}}, NLPModelMeta{Float64, Vector{Float64}}, LinearOperators.DiagonalQN{Float64, Int64, Vector{Float64}, LinearOperators.var"#84#85"{Vector{Float64}}}}
x::Vector{Float64}
Body::LinearOperators.DiagonalQN{Float64, Int64, Vector{Float64}, LinearOperators.var"#84#85"{Vector{Float64}}}
1 ─ %1 = Core.NamedTuple()::Core.Const(NamedTuple())
│ %2 = Base.pairs(%1)::Core.Const(Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}())
│ %3 = NLPModelsModifiers.:(var"#hess_op#20")(%2, #self#, nlp, x)::LinearOperators.DiagonalQN{Float64, Int64, Vector{Float64}, LinearOperators.var"#84#85"{Vector{Float64}}}
└── return %3 (no red). |
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.
Thanks @geoffroyleconte for the new models!
If you use these QuasiNewtonModel could you add later a short tutorial about it in the package documentation?
Sure. You mean improving the doc of each individual QN model or an example in the /docs (I can see that there is no tutorial page on this package but I can add one later)? |
Yes, a tutorial-like page for the QN models. We are starting from scratch here, so anything will be helpful :) |
Add DiagonalQNModel and SpectralGradientModel based upon the operators in LinearOperators.
I dropped NLPModels 0.18 because there were failures when testing the package with the counters and the show functions (AmplNLReader tests fail because of this).