Skip to content

Make R2N more flexible for users #194

@MaxenceGollier

Description

@MaxenceGollier

I have two suggestions for R2N that would be very useful for me. I will try to implement them in a near future.

  1. When I use R2N with the full Hessian, I'd need the Hessian stored in a sparse matrix format and to be able to access it through R2NModel I suggest having two different R2NModel structs: one called R2NModel_op that has the current implementation, i.e the one with the linear operator for the Hessian stored:

    mutable struct R2NModel{T <: Real, V <: AbstractVector{T}, G <: AbstractLinearOperator{T}} <:
    AbstractNLPModel{T, V}
    B::G
    ∇f::V
    v::V
    σ::T
    meta::NLPModelMeta{T, V}
    counters::Counters
    end

    the other one would be called R2NModel_full and would have the Hessian stored in, say, SparseMatrixCOO format. The type of R2NModel used by R2N would be dispatched as a keyword argument in the R2NSolver constructor (defaulting to the LinearOperator version). For this to work out we'd also need to modify the line
    solver.subpb.model.B = hess_op(nlp, xk)
    , replacing it with hess_coord when the full hessian option is used.

  2. In a constrained optimization context, I'd need to make a different update for the quasi-Newton approximation, with the difference of gradients of Lagrangians instead of the objective. I think the following lines should be a function called update_qn! that can be modified by the user:

    if quasiNewtTest
    @. ∇fk⁻ = ∇fk - ∇fk⁻
    push!(nlp, s, ∇fk⁻)
    end
    .

Please let me know what you think @dpo @MohamedLaghdafHABIBOULLAH !

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions