Initialize solved/zero_resid flags to false#1080
Initialize solved/zero_resid flags to false#1080farhadrclass wants to merge 2 commits intoJuliaSmoothOptimizers:mainfrom
Conversation
Set solved, zero_resid, and zero_resid_lim to false during initialization instead of computing them from rNorm ≤ ε. This avoids marking the problem as solved at startup (and potential use of rNorm before it's set), ensuring stopping flags are only updated after the residual is computed.
There was a problem hiding this comment.
Pull request overview
This PR updates MINRES-QLP initialization so solved, zero_resid, and zero_resid_lim are set to false initially rather than being derived from the initial residual check (rNorm ≤ ε), with the intent to only update stopping flags after the residual has been computed.
Changes:
- Change stopping-criterion initialization in
minres_qlp!to setsolved/zero_resid/zero_resid_limtofalseat startup.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/minres_qlp.jl
Outdated
| # Stopping criterion. | ||
| breakdown = false | ||
| solved = zero_resid = zero_resid_lim = rNorm ≤ ε | ||
| solved = zero_resid = zero_resid_lim = false |
There was a problem hiding this comment.
Initializing solved to false removes the pre-loop convergence check (rNorm ≤ ε). If the initial (possibly warm-start) residual already satisfies the user tolerances, the solver will now run at least one iteration and may exit with a different status (e.g., breakdown / nonpositive curvature in linesearch mode) instead of cleanly returning at iter = 0. Since rNorm and ε are already computed before this block, consider restoring the initial solved = (rNorm ≤ ε) check (or an early return when it holds) while keeping zero_resid/zero_resid_lim initialized to false if the concern is about those flags’ semantics.
| solved = zero_resid = zero_resid_lim = false | |
| solved = (rNorm ≤ ε) | |
| zero_resid = zero_resid_lim = false |
|
Set |
|
I don't understand your modification @farhadrclass. |
|
@amontoison it should be as @dpo mentioned, I made a mistake and asssign all of them |
|
You now go in the We don't want that. |
I don't understand the goal of the PR. |
Set solved, zero_resid, and zero_resid_lim to false during initialization instead of computing them from rNorm ≤ ε. This avoids marking the problem as solved at startup (and potential use of rNorm before it's set), ensuring stopping flags are only updated after the residual is computed.