Skip to content

Commit

Permalink
Add DiagonalBFGS model
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedLaghdafHABIBOULLAH committed Sep 12, 2024
1 parent 11e1a1d commit 16831f1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/quasi-newton.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ export AbstractDiagonalQNModel,
LSR1Model,
DiagonalPSBModel,
DiagonalAndreiModel,
SpectralGradientModel
SpectralGradientModel,
DiagonalBFGSModel

abstract type QuasiNewtonModel{T, S} <: AbstractNLPModel{T, S} end
abstract type AbstractDiagonalQNModel{T, S} <: QuasiNewtonModel{T, S} end
Expand Down Expand Up @@ -105,6 +106,14 @@ function SpectralGradientModel(nlp::AbstractNLPModel{T, S}; σ::T = one(T)) wher
return DiagonalQNModel{T, S, typeof(nlp), typeof(nlp.meta), typeof(op)}(nlp.meta, nlp, op)
end

function DiagonalBFGSModel(
nlp::AbstractNLPModel{T, S};
d0::S = fill!(S(undef, nlp.meta.nvar), one(T)),
) where {T, S}
op = DiagonalBFGS(d0)
return NLPModelsModifiers.DiagonalQNModel{T, S, typeof(nlp), typeof(nlp.meta), typeof(op)}(nlp.meta, nlp, op)
end

NLPModels.show_header(io::IO, nlp::QuasiNewtonModel) =
println(io, "$(typeof(nlp)) - A QuasiNewtonModel")

Expand Down

0 comments on commit 16831f1

Please sign in to comment.