Skip to content

Introduce getters for components of a QuasiNewtonModel#142

Merged
dpo merged 1 commit into
mainfrom
qn-getters
Mar 13, 2026
Merged

Introduce getters for components of a QuasiNewtonModel#142
dpo merged 1 commit into
mainfrom
qn-getters

Conversation

@dpo

@dpo dpo commented Mar 11, 2026

Copy link
Copy Markdown
Member

Without those getters, certain operations in NLPModelstests (e.g., the derivative checker) fail for user-defined quasi-Newton models whose fields have names other than "model" or "op".

Copilot AI review requested due to automatic review settings March 11, 2026 20:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces an accessor-based interface (get_model, get_op) for QuasiNewtonModel wrappers so internal delegation no longer assumes the wrapped components are stored in fields named model/op, addressing failures in downstream test tooling for user-defined quasi-Newton models.

Changes:

  • Add and export get_model(::QuasiNewtonModel) / get_op(::QuasiNewtonModel) and switch quasi-Newton wrapper methods to delegate through these accessors.
  • Update QuasiNewtonModel display/reset/linear operator interactions to use get_model/get_op.
  • Adjust quasi-Newton tests to use get_model(nlp) instead of nlp.model.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
src/quasi-newton.jl Adds exported getters and refactors delegation to avoid direct .model/.op access.
test/nlp/quasi-newton.jl Updates a test assertion to use the new accessor.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/quasi-newton.jl
Comment thread src/quasi-newton.jl Outdated
Comment thread test/nlp/quasi-newton.jl
Comment thread src/quasi-newton.jl
@github-actions

github-actions Bot commented Mar 11, 2026

Copy link
Copy Markdown
Contributor
Package name latest stable
FletcherPenaltySolver
JSOSolvers
JSOSuite
LLSModels
NLPModelsIpopt
NLPModelsKnitro
NLPModelsTest
PartiallySeparableNLPModels
Percival
QuadraticModels
RegularizedOptimization
RipQP

Without those getters, certain operations in NLPModelstests
(e.g., the derivative checker) fail for user-defined quasi-Newton
models whose fields have names other than "model" or "op".

At the same time, do not automatically forward neval_hprod to
avoid overwriting the method later (as that prevents
precompilation).
@dpo

dpo commented Mar 12, 2026

Copy link
Copy Markdown
Member Author

@dpo dpo closed this Mar 12, 2026
@dpo dpo reopened this Mar 12, 2026
@dpo dpo closed this Mar 13, 2026
@dpo dpo reopened this Mar 13, 2026
@dpo dpo closed this Mar 13, 2026
@dpo dpo reopened this Mar 13, 2026
@dpo dpo merged commit 8e96cfc into main Mar 13, 2026
152 of 188 checks passed
@dpo dpo deleted the qn-getters branch March 13, 2026 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants