Repository navigation
fix(solver): late acceptance re-anchors only on a dominating level ch… - #242
Merged
blackopsrepl merged 1 commit intoNov 10, 2026
Conversation
…ange LateAcceptanceAcceptor refilled its whole history with every new best score. After the first improvement every entry equals the best, so a move is accepted only when it scores at least the best, and each further best refills again: from then on the acceptor is hill climbing with sideways moves, not late acceptance, and searches that rely on accepting worse moves to leave a local optimum settle early. The history is now re-anchored to the best score only when one of its dominating levels changes (the hard level of a hard/soft score; hard and medium for hard/medium/soft), which keeps the guard against stale entries admitting moves that hold a newly reached level but ruin the lower ones. Improvements in the lowest level alone leave the history as it is, and a single-level score never re-anchors, as the published algorithm has it. Tests: two cases that the previous code fails (a lowest-level improvement keeps the late threshold, for a single-level and a hard/soft score) and one that both pass (a hard-level change re-anchors).
Collaborator
|
Thank you for this, and for the clear write-up. You're right: refilling the whole history on every new best quietly turned late acceptance into hill climbing after the first improvement. We're folding your commit into the next release as is, with one small follow-up so bendable scores re-anchor only when a hard level changes. Much appreciated! |
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.
Change and Purpose
Since c084b5c,
LateAcceptanceAcceptor::step_endedrefills the whole score history with everynew best score. After the first improvement that leaves every entry equal to the best, so a move
is accepted only when it scores at least the best (the late threshold) or at least the last step
(which also scores at least the best). Each further improvement refills again, so the invariant
never breaks: from the first improvement on the acceptor is hill climbing with sideways moves,
not late acceptance, and searches that rely on accepting worse moves to leave a local optimum
settle early.
The history is now re-anchored to the best only when one of its dominating levels changes (the
hard level of a hard/soft score; hard and medium of a hard/medium/soft score). That keeps the
intent of c084b5c, stale entries from before a feasibility change must not admit moves that
hold the new level but ruin the lower ones, while improvements in the lowest level alone leave
the history as it is. A single-level score never re-anchors, as the published algorithm
(Burke & Bykov, "The late acceptance hill-climbing heuristic", 2017) has it.
dominating_level_changedcompareslevel_number(i)fori < levels_count() - 1, so thechange is allocation-free and generic over
Score.Verification
Commands and results on the branch (macOS, Rust 1.99.1):
make build: ok.make test: ok, every crate green, including 779 solver lib tests.make fmt-check,make clippy,make doc-names,make file-length,make facade-reachability,make public-api: all ok.LateAcceptanceAcceptorispub(crate), so the public API snapshot is unchanged.make depswas not run:cargo-macheteandcargo-denyare not installed here. The changetouches no manifest, so there is nothing new for it to flag.
New tests in
acceptor/tests.rs:late_acceptance_keeps_history_after_lowest_level_improvement(single-level score) andlate_acceptance_keeps_history_after_soft_only_improvement(hard/soft score): fail onmain,pass on the branch.
late_acceptance_re_anchors_when_a_dominating_level_changes: passes on both, pins thebehaviour that is kept.
Review Checklist