You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: some terminations do not honor their contracts - #2801
…that can end the phase
Simulated annealing cools by the time gradient of the phase termination.
- OR and AND composites now return -1.0 when no termination supports a time gradient,
as the contract says. OR returned 0.0 and AND 1.0, so simulated annealing did not cool,
or started at its minimum temperature, and a nested composite hid the gradient of the others.
- The solver bridge now includes the phase-only terminations of the solver termination,
which can end the phase too. Diminished returns configured at solver level never reached the gradient.
- Diminished returns now estimates the time gradient: one sliding window is left
after the time since its grace period started. This estimate was chosen from six candidates
in an offline replay of diminished returns on quickstart runs.
- Without any termination that can estimate the time left, for example when only terminateEarly()
stops the solver, simulated annealing keeps its starting temperature, as before, and logs a warning.
# Conflicts:
# core/src/test/java/ai/timefold/solver/core/impl/solver/termination/DiminishedReturnsTerminationTest.java
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The bridge understates the time gradient for mixed AND terminations, keeping simulated annealing near its starting temperature until the deadline; the gradient calculation needs correction and a mixed-AND regression test.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Short-circuiting in solver-level AND termination leaves the diminished-returns grace period stale after harder-score changes, preventing simulated annealing from reheating and requiring a state-reset fix with regression coverage.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The AND termination short-circuits stateful diminished-returns updates until the time limit expires, corrupting its baseline and potentially ending a phase despite constant-rate score improvement.
For a solver-level AND of a time limit and diminished returns, this early return prevents diminished returns from updating its grace period until the time limit expires. With a 300-second limit, a 30-second window and a 0.5 minimum ratio, this records 300 seconds of improvement as the baseline and can incorrectly end the phase even when the score improves at a constant rate. Evaluate every child before returning the combined result so that stateful terminations keep their windows current.
The grace period restarted only inside isPhaseTerminated().
An AND skips that call after a termination that is not met,
so the restart came late, and simulated annealing did not heat up again.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Representative end-to-end quality benchmarks are needed because replaying prior runs cannot validate how the new cooling estimate affects annealing, diminished returns, and future improvements.
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
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.
We address the following issues: