Skip to content

Fix TrunkSolver for quasi-Newton models - #354

Closed
dpo wants to merge 3 commits into
mainfrom
trunk-patch-qn
Closed

Fix TrunkSolver for quasi-Newton models#354
dpo wants to merge 3 commits into
mainfrom
trunk-patch-qn

Conversation

@dpo

@dpo dpo commented Jan 28, 2026

Copy link
Copy Markdown
Member

If the solver is initialized with a model that is not a quasi-Newton model, applying it to a quasi-Newton model with the same dimensions later fails at line 240.

This change always allocates a vector inside the solver to store the previous gradient.

If the solver is initialized with a model that is not
a quasi-Newton model, applying it to a quasi-Newton
model with the same dimensions later fails.

This change always allocates a vector inside the solver
to store the previous gradient.
Copilot AI review requested due to automatic review settings January 28, 2026 13:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes TrunkSolver reuse when switching from a non–quasi-Newton model to a QuasiNewtonModel of the same dimension by ensuring the “previous gradient” workspace is always allocated.

Changes:

  • Always allocate gn (previous-gradient storage) in TrunkSolver regardless of the initial model type.
  • Remove the reset! assertion that prevented reusing a solver instance across quasi-Newton vs non–quasi-Newton models.

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

Comment thread src/trunk.jl Outdated
Comment thread src/trunk.jl Outdated
dpo and others added 2 commits January 28, 2026 09:06
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor
Package name latest stable
FletcherPenaltySolver
JSOSuite
PartiallySeparableNLPModels
Percival

@github-actions

Copy link
Copy Markdown
Contributor
Package name latest stable
FletcherPenaltySolver
JSOSuite
PartiallySeparableNLPModels
Percival

@github-actions

Copy link
Copy Markdown
Contributor
Package name latest stable
FletcherPenaltySolver
JSOSuite
PartiallySeparableNLPModels
Percival

@dpo
dpo marked this pull request as draft January 29, 2026 16:09
@dpo

dpo commented Jan 29, 2026

Copy link
Copy Markdown
Member Author

I may not merge this as I would like to manage quasi-Newton updates in the callback instead of in the solver.

@dpo

dpo commented Feb 20, 2026

Copy link
Copy Markdown
Member Author

Superseded by #358.

@dpo dpo closed this Feb 20, 2026
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