Repository navigation
fix(solver): place required assignments through the construction cursor - #285
Merged
Merged
Conversation
The neighborhood case built its starting roster with a construction solve, so the case also ran the construction code under change and its heap layout moved with it. Build a feasible roster directly instead: shift s of day d goes to nurse (s + 6d) mod 24, which keeps each nurse on one shift a day and on the same shift type from day to day. One iteration enumerates every grouped-scalar family in about 15 ms, so the case now measures four iterations per trial (about 60 ms) instead of the default, which brings the full gate back to its usual length.
n120w8 rostering instances (2844 and 2872 required shifts) ended a 1 s solve with every required shift unassigned (#283). Required construction committed one dense batch move that placed all directly placeable rows outside the cursor and outside incremental scoring; after 3992802 its pending view made that batch quadratic, and it timed out before publishing anything. Remove the batch. Required rows are placed one move at a time by the required cursor and scored incrementally, and the cursor no longer redoes whole-problem work per placement: - The placer cursor keeps the assignment generator across placements (`recycle`), refreshes only the rows the placement's candidates touched, drops newly assigned rows from the value degrees and resumes after the placed row. A generator that finds nothing more is rebuilt from the solution once, so rows skipped earlier get another pass. - Completed construction slots are probed only for rows that can be completed at the current revision instead of every row of the group. - A required row tries every value directly before any value with augmenting rematches, so a row with a free value never pays for a rematch search. This also reverts the path-overlay index of 9ab0b17, which only served the batch, and keeps the scanning overlay of 0.31.4. Both instances now finish feasible at 1 s: H0 0hard/-224820soft (2844 placements in 69 ms), H1 0hard/-223990soft (2872 in 75 ms). Fixes #283
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.
Fixes #283.
Problem
The n120w8 INRC-II instances H0_WD0-9-9-4-5-1-0-3 and H1_WD7-2-6-4-5-2-0-2 ended a 1 s solve with all 2844 / 2872 required shifts unassigned.
Required construction committed one dense batch move. That batch placed every directly placeable row outside the construction cursor and outside incremental scoring. Since 3992802 (0.20.4), its pending view scanned every pending row for each query, so the batch was quadratic. It ran past the 1 s limit, and the solve published nothing.
#284 indexed that pending view. Its gate failed
sim_d1_missesonassignment_neighborhoodandconstruction_first_fit. This PR reverts that change.Change
recycle. It refreshes only the rows the placement's candidates touched, drops newly assigned rows from the value degrees, and resumes after the placed row. When a carried generator finds nothing more, it is rebuilt from the solution once, so rows skipped earlier get another pass.assignment_path.rsandassignment_path_overlay.rsare back to their 0.31.4 contents.assignment_neighborhoodnow builds its roster directly instead of through a construction solve, so it measures only the neighborhood. It runs 4 iterations per trial (about 60 ms).Verification
tests/construction_resume.rs); each fails with its mechanism disabled:make lint: exit 0.make test: exit 0.assignment_requiredconstructs a different roster by design now that the batch is gone. For that case only output identity is exempt; speed, allocations and memory are graded as usual.