Repository navigation
fix(scoring): retract cascading list arrivals before their structure shadows change - #271
Closed
blackopsrepl wants to merge 1 commit into
Closed
blackopsrepl wants to merge 1 commit into
blackopsrepl wants to merge 1 commit into
Conversation
…shadows change With a cascading shadow, an owner's refresh rewrote the inverse, previous and next fields of every element it held before retracting the rows of elements that arrived from no list. A constraint reading any of those fields retracted a different score from the one it inserted, and the incremental score drifted from a fresh one. Arrivals are now retracted first, as the non-cascading refresh does. The director test's cost now tells an unset start in no list from one on a machine, which fails without the fix.
Collaborator
Author
Zero-regression gate —
|
Collaborator
Author
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.
Bug
With a cascading list shadow,
refresh_cascading_ownercalledupdate_list_structure_shadowsbefore retracting the rows of elements that arrived from no list. By the time an arrival's row was retracted, its inverse, previous and next fields already held the new values. A constraint reading any of those fields retracted a different score from the one it inserted, so the incremental score drifted from a fresh one.The refresh without a cascading shadow (
refresh_owner) already retracts arrivals before rewriting shadows. This change makes the cascading refresh do the same.Found in the SolverForge Workbench task scheduling model. Under
environment_mode = "full_assert"its first construction step drifted: incremental1000hard/-498medium, fresh0hard/-497medium. A rule there charges an untimed task on a resource differently from a task in no list.Change
crates/solverforge-scoring/src/director/score_director/list_shadows.rs: retract arrivals from no list, then refresh the list structure and insert the owner row.crates/solverforge-scoring/src/director/tests/cascading_shadows.rs: the cost now charges an unset start differently in no list (1000) and on a machine (5000). Without the fix,a_task_pushed_later_on_the_saw_retimes_its_milling_on_the_millandrandom_moves_and_undos_on_three_machines_keep_the_score_freshfail by exactly 4000 per arrival. With the fix, both pass.Performance
Only the
PlanningSolution::HAS_CASCADING_SHADOWSbranch changes: the same calls run, in a different order. Solutions without a cascading shadow never reach this code.Checks
make lint: fmt, clippy, doc names, file length, facade reachability, public API, deps.cargo test --workspace --no-fail-fast.