Skip to content

Speed up mixed-inventory closure search with slippage - #14

Merged
senegrom merged 1 commit into
mainfrom
improve/mixed-slippage-search
Sep 14, 2026
Merged

senegrom merged 1 commit into
mainfrom
improve/mixed-slippage-search

Conversation

@senegrom

@senegrom senegrom commented Sep 14, 2026

Copy link
Copy Markdown
Owner

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:

Case Nodes before → after Time before → after
Broad mixed, exact 22,155 → 16,451 1.502 → 1.108 s
Broad mixed, 1 mm 29,936 → 24,111 2.429 → 1.840 s
Broad mixed, 5 mm 30,339 → 24,514 2.366 → 1.904 s
Broad forced offset, 5 mm 286 → 24 29.1 → 12.7 ms

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:

  • 1,298 regular Python tests passed locally.
  • 55 JavaScript tests passed.
  • Ruff and diff whitespace checks passed.
  • Full benchmark comparison ran sequentially, with result fingerprints checked across repeats.
  • GitHub Python 3.12 and 3.13: 1,298 tests passed on each; base install passed.
  • Chromium: 20 browser tests passed. WebKit: 19 passed, one intentional Chromium-only touch test skipped. Both use real Pyodide under production CSP; each also passed all 55 JavaScript tests.
  • CodeQL: passed for Python, JavaScript/TypeScript, and Actions.
  • Separate AI security scan could not run: GitHub returned HTTP 403, 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.

@senegrom
senegrom merged commit 8126bc7 into main Sep 14, 2026
10 of 11 checks passed
@senegrom
senegrom deleted the improve/mixed-slippage-search branch September 14, 2026 03:41
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.

1 participant