Repository navigation
fix(termination)!: apply every criterion, literal time limits, no hidden limit - #183
Merged
Merged
Conversation
`seconds_spent_limit = 0` (or `minutes_spent_limit = 0`) meant no limit, and `minutes_spent_limit * 60` could overflow. `TerminationConfig::time_limit` is now `None` only when neither field is set, so zero is a limit of zero, and the sum saturates at `Duration::MAX`. BREAKING CHANGE: `seconds_spent_limit = 0` or `minutes_spent_limit = 0` is now a zero time limit instead of no limit.
Solver-level `[termination]` honoured only the first of `best_score_limit`, `step_count_limit`, `unimproved_step_count_limit` and `unimproved_seconds_spent_limit`, paired with the time limit; the others were silently ignored, while phase-level termination combined all of them. `ConfiguredSolverTermination` now holds every configured criterion as its own concrete termination and stops the solve at whichever is reached first. It replaces `AnyTermination` and the tuple `OrTermination`. The candidate trace execution policy lists every installed criterion. BREAKING CHANGE: every configured solver-level termination criterion now applies, combined with OR; a solve with several criteria can stop earlier than before. The `solverforge.execution_policy` trace drops the `criterion` and `criterion_target` attributes and gains one attribute per criterion; `termination_composition` names every installed criterion.
A solve with a score or work criterion but no time limit was silently capped at 30 seconds (60 for list models) by `__solverforge_default_time_limit_secs`. The fallback is gone: nothing is added that is not configured, so a score or work criterion without a time limit runs without one. The generated function and the `default_time_limit_secs` parameter of the run entrypoints are removed, and the execution-policy trace no longer records a fallback. Closes #174. BREAKING CHANGE: a solve with `best_score_limit`, `step_count_limit` or an unimproved limit but no `seconds_spent_limit`/`minutes_spent_limit` is no longer capped at 30 or 60 seconds. `try_run_solver_with_config_and_search`, `try_run_weighted_solver_with_config_and_search` and `try_run_dynamic_solver_with_config_parts` lose their `default_time_limit_secs` parameter. The `solverforge.execution_policy` trace drops `configured_entrypoint_default_time_limit_ns`, `effective_time_limit_ns` and `time_limit_source`.
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.
Closes #174. Base
main@51e1bcaf, three commits:df48d5a7make time_limit literal and saturating9a27c3bcapply every configured solver termination criterionfb8a0e0eadd no hidden time limitGate on
fb8a0e0e(fmt, clippy -D warnings, doc-names file-length facade-reachability public-api deps, rustdoc -D warnings, examples, workspace all-feature tests, doctests): EXIT 0, 1521 passed, 0 failed, 65 result lines. Slice checks:df48d5a7871 passed / 0 failed;9a27c3bc888 passed / 0 failed (clippy, rustdoc, public-api, config/solver/bridge/trybuild/facade tests). Mutation checks: the oldtime_limitfailstime_limit_is_literal_and_saturating; dropping the step criterion failsevery_configured_criterion_applies.