Speed up mixed-inventory closure search with slippage - #14
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.
Broad mixed-inventory completion searches with 1–5 mm slippage still used more than 25,000 states to find eight closures. The traversal relaxation treated a free crossing route as another unrestricted move, allowing it to provide turning capacity that the crossing does not have.
This change bounds heading change separately using remaining placement slots, actual turning stock, and existing/future junction transit allowances. A future reversing target consumes one placement and one copy of its junction's turn allowance before its tail. Future-target cache keys include that allowance so backtracking cannot reuse a proof under a different stock budget. Candidate order, exact joint checks, collision audits, and preprocessing limits are preserved.
Local Python 3.12 three-run medians versus
c320424:Both builds produce the same eight ordered results in these rows. The baseline has a 60,000-node budget to finish the mixed cases; this branch uses 25,000. At 25,000 the baseline found no mixed slippage results. All 27 existing benchmark fingerprints match. The 1 mm switch benchmark is about 5% slower; the performance notes include this and small-case overhead.
Three new benchmarks cover an existing switch supplying a 30° turn with no spare stock, including exact endpoints, a 5 mm forced joint, and a 4.9 mm near miss. The suite now has 30 cases, including 20 slippage cases. Thirty-five added regression cases cover both engines, both switch branches/directions, rotated/elevated poses, scarce stock, backtracking, a custom junction traversed twice, and the mixed cases below 25,000 nodes.
Validation:
You are not licensed to use Copilot.This is the existing licensing failure; application checks and CodeQL passed.Merged as
8126bc7. The main pipeline passed and GitHub Pages deployment succeeded. The merged tree exactly matches the tested PR tree.