Skip to content

Conversation

@dpo
Copy link
Member

@dpo dpo commented Jan 28, 2026

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
Copy link
Contributor

Copilot AI left a comment

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.

@github-actions
Copy link
Contributor

Package name latest stable
FletcherPenaltySolver
JSOSuite
PartiallySeparableNLPModels
Percival

@github-actions
Copy link
Contributor

Package name latest stable
FletcherPenaltySolver
JSOSuite
PartiallySeparableNLPModels
Percival

@github-actions
Copy link
Contributor

Package name latest stable
FletcherPenaltySolver
JSOSuite
PartiallySeparableNLPModels
Percival

@dpo dpo marked this pull request as draft January 29, 2026 16:09
@dpo
Copy link
Member Author

dpo commented Jan 29, 2026

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

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.

1 participant