Skip to content

fix(solver): late acceptance re-anchors only on a dominating level ch… - #242

Merged
blackopsrepl merged 1 commit into
SolverForge:mainfrom
slapers:fix/late-acceptance-reanchor-on-dominating-level
Nov 10, 2026
Merged

blackopsrepl merged 1 commit into
SolverForge:mainfrom
slapers:fix/late-acceptance-reanchor-on-dominating-level

Conversation

@slapers

@slapers slapers commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Change and Purpose

Since c084b5c, LateAcceptanceAcceptor::step_ended refills the whole score history with every
new 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_changed compares level_number(i) for i < levels_count() - 1, so the
change 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. LateAcceptanceAcceptor is
    pub(crate), so the public API snapshot is unchanged.
  • make deps was not run: cargo-machete and cargo-deny are not installed here. The change
    touches 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) and
    late_acceptance_keeps_history_after_soft_only_improvement (hard/soft score): fail on main,
    pass on the branch.
  • late_acceptance_re_anchors_when_a_dominating_level_changes: passes on both, pins the
    behaviour that is kept.

Review Checklist

  • I understand the final diff and will address review findings.
  • The change follows the relevant architecture and style rules in AGENTS.md.
  • Tests cover changed behavior.
  • Documentation and affected wireframes match any public API changes (no public API change).
  • The contribution respects copyright, attribution, license compatibility, and confidentiality.

…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).
@blackopsrepl

Copy link
Copy Markdown
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!

@blackopsrepl
blackopsrepl merged commit e1b41b4 into SolverForge:main Nov 10, 2026
7 checks passed
@slapers
slapers deleted the fix/late-acceptance-reanchor-on-dominating-level branch November 26, 2026 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants