Skip to content

Add opt-in congestion rerouting to the section pipeline - #201

Open
0hmX wants to merge 1 commit into
mainfrom
codex/congestion-reroute-solver
Open

0hmX wants to merge 1 commit into
mainfrom
codex/congestion-reroute-solver

Conversation

@0hmX

@0hmX 0hmX commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Add an optional TinyHyperGraphCongestionSolver after section optimization. It tries four single-route reroutes around congested regions, with a 2,000-step budget per trial, using the existing outside-in route search. Enable it with congestionSolverOptions: {}; the default pipeline is unchanged.

Each replacement is isolated from the retained routes and accepted only after rebuilding costs from the serialized paths. Neither maximum region cost nor the sum of squared region costs may increase. The stage preserves endpoints, metadata, masks, and protected routes; unsuccessful attempts retain the complete solution. A pipeline timeout also retains any improvement already accepted.

The class comment explains the algorithm and includes a short Dictionary defining only “Trial” and “Serialized replay.” The PR contains the selected approach, tests, and benchmark support; it does not include the experiment history or unused search strategies.

Benchmark results

Measured with the repository scripts on the final implementation, comparing the default pipeline with --optimize-congestion:

Dataset Completed, before → after Mean relative cost reduction Improved / regressed cases Total sample time, before → after
SRJ18 8/8 → 8/8 11.02% 4 / 0 9.42s → 12.67s
HG07 104/105 → 104/105 5.71% 38 / 0 3.32s → 5.87s

Reduction is the mean of per-case relative maximum-region-cost changes across each full dataset; the existing HG07 sample014 loader failure contributes zero. No new completion failures occurred. Timings are local observations, not a speed improvement claim. Congestion cost is a graph metric, not physical DRC.

This remains opt-in: the earlier research configuration produced 0% improvement on 12 fresh SRJ13 cases, with completion unchanged at 5/12. That result does not establish a benefit on those inputs. The new stage preserves original pipeline preloads and scoring options, so the table above reports its actual results rather than reusing the research score.

Validation

  • bun test: 138 passed, 0 failed, including the snapshot check; no snapshot files changed.
  • bun run typecheck: passed.
  • bun run format:check: passed (two existing oversized-fixture warnings).
  • Independent review; fixed and regression-tested preservation of accepted output on pipeline timeout.
  • Canonical cost regression test for HG07 sample025, plus input immutability, protected routes, masks, metadata, invalid inputs, iteration limits, and pipeline integration.

Reproduce the paired benchmarks:

./benchmark.sh --dataset srj18 --concurrency 1
./benchmark.sh --dataset srj18 --concurrency 1 --optimize-congestion
./benchmark.sh --dataset hg07 --concurrency 1
./benchmark.sh --dataset hg07 --concurrency 1 --optimize-congestion

Inspired by tscircuit/tscircuit-autorouter#2639.

@tscircuitbot

Copy link
Copy Markdown

Benchmark This PR

Run benchmarks by commenting on this PR:

/benchmark [benchmark.sh args...]
/benchmark --dataset <hg07|srj18> --limit <n> --solver <core|poly> --families <default|default+deep|all> --concurrency <n|auto>

Everything after /benchmark is forwarded directly to ./benchmark.sh.
Every command runs current main and the PR head sequentially on the same Blacksmith machine, then reports their results side by side.

Examples:

  • /benchmark -> all committed completed SRJ18 Pipeline7 cases, core solver
  • /benchmark --limit 4 -> first four committed Pipeline7 cases
  • /benchmark --dataset srj18 --concurrency auto -> srj18 samples with runner CPU-count concurrency
  • /benchmark --sample sample003 -> one committed SRJ18 Pipeline7 case
  • /benchmark --dataset hg07 --limit 20 --solver poly -> first 20 hg07 samples with the poly solver
  • /benchmark --dataset hg07 --limit 40 --families default+deep -> first 40 hg07 samples with deeper candidate families

Any PR whose title contains [BENCHMARK TEST] will automatically run the benchmark workflow on PR updates.

@vercel

vercel Bot commented Sep 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
tiny-hypergraph Ready Ready Preview Sep 18, 2026 8:41pm UTC

Request Review

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.

2 participants