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

Add Counters to QuasiNewtonNLPModels #122

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/quasi-newton.jl
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@ function Base.show(io::IO, nlp::QuasiNewtonModel)
show(io, nlp.model.counters)
end

function Base.getproperty(nlp::QuasiNewtonModel, s::Symbol)
if s == :counters
return nlp.model.counters
else
return getfield(nlp, s)
end
end

MaxenceGollier marked this conversation as resolved.
Show resolved Hide resolved
@default_counters QuasiNewtonModel model

function NLPModels.reset_data!(nlp::QuasiNewtonModel)
Expand Down
3 changes: 2 additions & 1 deletion test/nlp/quasi-newton.jl
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@
@test Hop * v ≈ H(x) * v
Hop = hess_op!(nlp, x, Hv)
@test Hop * v ≈ H(x) * v

@test nlp.counters == nlp.model.counters
MaxenceGollier marked this conversation as resolved.
Show resolved Hide resolved

reset_data!(nlp)
Hop = hess_op!(nlp, x, Hv)
@test Hop * v == v
Expand Down