Repository navigation
fix: share crossing-reduction trial budget across groups - #22
Merged
Merged
Conversation
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.
Summary
Fixes
CONFIRMED-FINDINGS.mditem 7: the fixed crossing-reduction budget was consumed in group order, so early groups used it all before later groups were reached.src/layout.ts:swapsis renamed toswapTrialsand documented as pair trials, not accepted swaps. Each pass now visits pair index 0 of every eligible group, then pair index 1, etc., so one large early group cannot consume every later group's trials. The total 64-trial budget is unchanged.tests/core.test.ts: regression with a 66-pair early group; a later group still reverses a worse initial port order and shortens its route score. Verified to fail against the old loop.CHANGELOG.md: one scoped[Unreleased] / Fixedentry.Stress comparison
c4c086c4…557a99c4c086c4…557a99All five benchmark fixtures also produce identical diagnostics and scene hashes.
Verification
npm run format— passednpm run typecheck— passednpm run lint— passednpm test— 153 tests passednpm run build— passednpm run stress— 1758 crossings, 0 collisions, hashc4c086c4…557a99devand passes on the PR.Notes
The total 64-trial budget still cannot visit every group on a 150-group stress graph; groups after the cutoff receive no trial. Pass 0 can also still consume the total budget before pass 1. Enlarging or splitting the fixed total budget was out of scope; the changelog describes only the fair spreading of the existing budget.