Skip to content

fix(solver): nearest netlabel slide + penalize trace crossings (#2554, #2552)#574

Open
rovidev95 wants to merge 2 commits into
tscircuit:mainfrom
rovidev95:fix/2554-2552-routing-and-labels
Open

fix(solver): nearest netlabel slide + penalize trace crossings (#2554, #2552)#574
rovidev95 wants to merge 2 commits into
tscircuit:mainfrom
rovidev95:fix/2554-2552-routing-and-labels

Conversation

@rovidev95

Copy link
Copy Markdown

Summary

Addresses tscircuit/core#2554 and tscircuit/core#2552.

#2554 — net labels (y+/y-) slide too far

TraceAnchoredNetLabelOverlapSolver now sorts overlap-resolution candidates by distanceFromOriginal ascending, so the first valid candidate keeps power/ground labels closest to their anchor.

#2552 — trace crossings not penalized

SchematicTraceSingleLineSolver2 explores the BFS queue until empty, scores each collision-free path as crossings * 1000 + pathLength, and picks the best. SchematicTraceLinesSolver passes already-routed paths as existingTracePaths.

Tests

bun test tests/solvers/SchematicTraceSingleLineSolver2/countPathCrossings.test.ts
bun test tests/solvers/SchematicTraceSingleLineSolver2/SchematicTraceSingleLineSolver2_01-example17-d1_1-u1_1.test.ts

/attempt #2554
/attempt #2552

- #2554: sort trace-anchored netlabel overlap candidates by
  distanceFromOriginal so y+/y- labels stay near their anchor.
- #2552: explore collision-free routes and pick the path with the
  fewest crossings against already-routed traces, then shortest length.

Adds unit tests for orthogonal crossing detection.

Co-authored-by: Cursor <cursoragent@cursor.com>
@vercel

vercel Bot commented Jul 2, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
schematic-trace-solver Ready Ready Preview, Comment Jul 2, 2026 8:42am

Request Review

Co-authored-by: Cursor <cursoragent@cursor.com>
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