-
Notifications
You must be signed in to change notification settings - Fork 15
Fix TrunkSolver for quasi-Newton models #354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
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.
There was a problem hiding this 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) inTrunkSolverregardless 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.
Co-authored-by: Copilot <[email protected]>
|
I may not merge this as I would like to manage quasi-Newton updates in the callback instead of in the solver. |
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.