add step_status and step_status_reliable to stats#130
Merged
Conversation
Each solver can now set the step status (accepted or rejected) for use in a callback. This is particularly useful to perform quasi-Newton updates.
There was a problem hiding this comment.
Pull request overview
This PR extends GenericExecutionStats with a per-iteration step_status (and step_status_reliable) so solvers can report whether the most recent step was accepted/rejected for downstream callbacks (e.g., quasi-Newton updates).
Changes:
- Added
step_status/step_status_reliablefields and aset_step_status!setter, plus supportingSTEP_STATUSESutilities. - Extended
statsgetfieldto render:step_statusas a human-readable string. - Updated the NLPModels extension constructor and expanded tests to cover the new setter and reliability flag.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/stats.jl |
Adds step-status storage, validation, setter, and formatted access via statsgetfield. |
ext/SolverCoreNLPModelsExt.jl |
Threads the new step_status keyword through the NLPModels-specific constructor. |
test/test-stats.jl |
Adds tests for invalid step statuses and for the new reliability flag. |
Comments suppressed due to low confidence (1)
ext/SolverCoreNLPModelsExt.jl:85
- In the NLPModels extension constructor you validate
statusviaSolverCore.check_status(status), but the newly addedstep_statuskeyword is not validated. This allows invalidstep_statusvalues to be stored at construction time and later crash when rendering/logging (e.g.,getStepStatusindexingSTEP_STATUSES). Consider callingSolverCore.check_step_status(step_status)here as well (mirroring the status check).
step_status::Symbol = :unknown,
elapsed_time::Real = Inf,
solver_specific::Dict{Symbol, Tsp} = Dict{Symbol, Any}(),
) where {T, S, V, Tsp}
SolverCore.check_status(status)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
tmigot
reviewed
Feb 15, 2026
src/stats.jl
Outdated
| - `multipliers_L`: The Lagrange multipliers wrt to the lower bounds on the variables (default: an uninitialized vector like `nlp.meta.x0` if there are bounds, or a zero-length vector if not); | ||
| - `multipliers_U`: The Lagrange multipliers wrt to the upper bounds on the variables (default: an uninitialized vector like `nlp.meta.x0` if there are bounds, or a zero-length vector if not); | ||
| - `iter`: The number of iterations computed by the solver (default: `-1`); | ||
| - `step_status`: The status of the most recently computed step (`:unknown`, `:accepted` or `:rejected`); |
Member
There was a problem hiding this comment.
see show_step_statuses() for a list
Merged
tmigot
approved these changes
Feb 18, 2026
Member
tmigot
left a comment
There was a problem hiding this comment.
It looks good, thanks. Can you make a new release after that ? I think Maxence was waiting for it (see pr bumping the version number)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Each solver can now set the step status (accepted or rejected) for use in a callback.
This is particularly useful to perform quasi-Newton updates.
Related issues
There is no related issue.
Checklist