Skip to content

Conversation

0hmX
Copy link
Contributor

@0hmX 0hmX commented Oct 11, 2025

The TraceLabelOverlapAvoidanceSolver was doing too many things. And it was not using the iterative approach when solving! We fix that also add visualization for each step! a much more consistent system

Copy link

vercel bot commented Oct 11, 2025

@0hmX is attempting to deploy a commit to the tscircuit Team on Vercel.

A member of the Team first needs to authorize it.

@0hmX 0hmX changed the title refactor(pipeline): Decompose overlap solver and add unconditional final label placement refactor(pipeline): Decompose overlap solver Oct 11, 2025
Copy link

vercel bot commented Oct 11, 2025

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

Project Deployment Preview Comments Updated (UTC)
schematic-trace-solver Ready Ready Preview Comment Oct 12, 2025 1:43pm

@seveibar
Copy link
Contributor

Deployed

@seveibar
Copy link
Contributor

@0hmX you need to add jsdoc strings to each new solver, and honestly you should probably make them subsolvers because this increases the complexity of the pipeline.

Where possible visually demonstrate the input/output to these solvers using stackGraphicsHorizontally

@0hmX
Copy link
Contributor Author

0hmX commented Oct 11, 2025

might exceed the iteration limit of all is merged together! i will give it a try

@0hmX
Copy link
Contributor Author

0hmX commented Oct 11, 2025

It worked out!

@seveibar
Copy link
Contributor

@seveibar seveibar closed this Oct 11, 2025
@seveibar seveibar reopened this Oct 11, 2025
…nal label placement

The monolithic TraceLabelOverlapAvoidanceSolver has been decomposed into a more modular, multi-step pipeline to improve separation of concerns:
- LabelMergingSolver: Merges adjacent net labels into single targets.
- TraceLabelOverlapAvoidanceSolver: Reroutes traces around merged labels.
- TraceCleanupSolver: Optimizes the geometry of modified traces.

This refactoring revealed a bug where the final label placement was skipped if no traces were rerouted. A new, unconditional `finalNetLabelPlacementSolver` step has been added to the pipeline to fix this, ensuring labels are always drawn correctly.
@0hmX
Copy link
Contributor Author

0hmX commented Oct 12, 2025

@0hmX
Copy link
Contributor Author

0hmX commented Oct 12, 2025

Hope this PR makes it easier to understand what is going on under the hood! and visualized because that is the entire point of the refactor!

longDistancePairSolver?: LongDistancePairSolver
traceOverlapShiftSolver?: TraceOverlapShiftSolver
netLabelPlacementSolver?: NetLabelPlacementSolver
labelMergingSolver?: MergedNetLabelObstacles
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
labelMergingSolver?: MergedNetLabelObstacles
labelMergingSolver?: MergedNetLabelObstacleSolver

return [
{
inputProblem: instance.inputProblem,
problem: instance.inputProblem,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
problem: instance.inputProblem,
inputProblem: instance.inputProblem,

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one of our principles is variable transparency https://github.com/tscircuit/handbook/blob/main/guides/code.md

Copy link
Contributor

@seveibar seveibar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is still too messy, the directory name of stackGraphicsHorizontally needs to be changed, i'm a bit busy atm but will try to do a video refactor in <1hr

@0hmX
Copy link
Contributor Author

0hmX commented Oct 12, 2025

@seveibar I hope I am not pushing change that you feel are not needed at the moment. I don't want to be a jerk and push changes and refractors that just lead to wastage of maintainer time and resources. If this is not a real priority, we can close this. Maybe make some sub issues? That can be consumed progressively.

I can still work on this , but I hope I am not being a jerk and sending changes just not needed 🙂

@seveibar
Copy link
Contributor

@0hmX you're not doing anything wrong, I gave your review too much grief in the video because we get a lot of spammy PRs

The team is stressed working towards tscircuit/tscircuit#926 and this is why we're busy, this PR is good, and you're doing good work, just the timing is causing more brevity.

Copy link
Contributor

@seveibar seveibar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great improvement, here's a video discussing changes to make, i appreciate the effort and it is good!!!!

https://share.cleanshot.com/5RcXP0yT

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