Skip to content

Prefer node-box distance for assigning connection endpoints#655

Closed
0hmX wants to merge 1 commit intomainfrom
codex/implement-connection-points-in-hg-pipeline3
Closed

Prefer node-box distance for assigning connection endpoints#655
0hmX wants to merge 1 commit intomainfrom
codex/implement-connection-points-in-hg-pipeline3

Conversation

@0hmX
Copy link
Copy Markdown
Contributor

@0hmX 0hmX commented Mar 12, 2026

Motivation

  • pointsToConnect can lie outside obstacle centers so choosing the nearest node by center distance caused endpoints to be attributed to the wrong node in some scenarios (e.g. circuit018).
  • The pipeline expects endpoints to map to the most relevant node region, so assignment should prioritize proximity to the node box (rectangle) rather than only the node center.

Description

  • Added getDistanceToNodeBox helper to compute the shortest distance from a point to a node's rectangular box and getNodeForConnectionPoint to pick the best node by box distance (center distance used as a tiebreaker).
  • Replaced the previous center-distance selection in getConnectionsWithNodes with the new box-distance-based selection.
  • Added a regression test tests/bugs/get-connections-with-nodes-prefers-box-distance.test.ts that reproduces the center-vs-box mismatch and asserts the expected node assignment.
  • Files changed: lib/solvers/PortPointPathingSolver/getConnectionsWithNodes.ts and new test tests/bugs/get-connections-with-nodes-prefers-box-distance.test.ts.

Testing

  • Ran bun test tests/bugs/get-connections-with-nodes-prefers-box-distance.test.ts tests/bugs/missing-portpoints-001.test.ts and both tests passed (2 pass, 0 fail).
  • Executed the benchmark-style runTask checks for AssignableAutoroutingPipeline3 and AutoroutingPipelineSolver3_HgPortPointPathing on circuit018, and both solvers completed with didSolve: true (relaxed DRC checks returned relaxedDrcPassed: false for the scenario).

Codex Task

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 12, 2026

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

Project Deployment Actions Updated (UTC)
capacity-node-autorouter Ready Ready Preview, Comment Mar 12, 2026 7:28pm

Request Review

@tscircuitbot
Copy link
Copy Markdown

🏃 Benchmark This PR

Run benchmarks by commenting on this PR:

/benchmark [solver-name|all] [scenario-limit] --concurrency <n> --effort <n>

Examples:

  • /benchmark -> AutoroutingPipelineSolver, all scenarios (default concurrency uses the benchmark runner CPU count)
  • /benchmark AutoroutingPipelineSolver -> one solver, all scenarios
  • /benchmark all 20 -> all solvers, first 20 scenarios
  • /benchmark AutoroutingPipelineSolver 20 --concurrency 8 -> one solver, 20 scenarios, 8 workers
  • /benchmark AutoroutingPipelineSolver 20 --effort 2 -> one solver, 20 scenarios, 2x effort

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

@0hmX
Copy link
Copy Markdown
Contributor Author

0hmX commented Mar 12, 2026

/benchmark AutoroutingPipelineSolver3_HgPortPointPathing

@tscircuitbot
Copy link
Copy Markdown

🏃 Autorouting Benchmark

⏳ Running benchmark on b407f4d...

🔗 Workflow: View run

@0hmX
Copy link
Copy Markdown
Contributor Author

0hmX commented Mar 12, 2026

/benchmark AutoroutingPipelineSolver3_HgPortPointPathing

@tscircuitbot
Copy link
Copy Markdown

tscircuitbot commented Mar 12, 2026

🏃 Autorouting Benchmark Results

📊 PR Results
Benchmark Results (1x effort)

+-----------------------------------------------+-------------+--------------------+-----------+----------+----------+
| Solver                                        | Completed % | Relaxed DRC Pass % | Timed Out | P50 Time | P95 Time |
+-----------------------------------------------+-------------+--------------------+-----------+----------+----------+
| AutoroutingPipelineSolver3_HgPortPointPathing | 74.3%       | 1.9%               | 0/105     | 2.2s     | 24.6s    |
+-----------------------------------------------+-------------+--------------------+-----------+----------+----------+

Scenarios: 105
📊 Main Branch Results
Benchmark Results (1x effort)

+---------------------------+-------------+--------------------+-----------+----------+----------+
| Solver                    | Completed % | Relaxed DRC Pass % | Timed Out | P50 Time | P95 Time |
+---------------------------+-------------+--------------------+-----------+----------+----------+
| AutoroutingPipelineSolver | 83.8%       | 1.9%               | 0/105     | 9.5s     | 71.8s    |
+---------------------------+-------------+--------------------+-----------+----------+----------+

Scenarios: 105

📦 Artifact: https://github.com/tscircuit/tscircuit-autorouter/actions/runs/23021737257

@github-actions
Copy link
Copy Markdown

This PR has been automatically marked as stale because it has had no recent activity. It will be closed if no further activity occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants