feat: deterministic row layout for decoupling capacitor partitions#93
Open
SealKan wants to merge 1 commit into
Open
feat: deterministic row layout for decoupling capacitor partitions#93SealKan wants to merge 1 commit into
SealKan wants to merge 1 commit into
Conversation
When SingleInnerPartitionPackingSolver encounters a partition with partitionType="decoupling_caps" it now skips PackSolver2 entirely and places all caps in a horizontal row centered at the origin. Chips are sorted by natural/numeric chip ID (C1, C2, C10 not C1, C10, C2) and spaced by decouplingCapsGap (falls back to chipGap). Rotations 0 and 180 are preferred; 90/270 are handled correctly by swapping the width dimension used for spacing. Adds 6 unit tests covering placement positions, natural sort order, gap fallback, rotation dimension swap, and absence of PackSolver2. Fixes tscircuit#15 /claim tscircuit#15
|
@SealKan is attempting to deploy a commit to the tscircuit Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #15
/claim #15
What
When
SingleInnerPartitionPackingSolverprocesses a partition withpartitionType="decoupling_caps", it now bypassesPackSolver2entirely and places all capacitors in a deterministic horizontal row
centered at the origin.
How
Added
createDecouplingCapsRowLayout()inlib/solvers/PackInnerPartitionsSolver/SingleInnerPartitionPackingSolver.ts:C1, C2, C10— not lexicographicC1, C10, C2) usingIntl.Collator({numeric:true})cursor = -totalWidth/2, each cap placed atcursor + width/2, thencursor += width + gapdecouplingCapsGapif present, falls back tochipGap0 > 180 > 90 > 270— prefers portrait axis; when90/270is chosen,size.yis used as the row-spacing widthPackSolver2is never instantiated:activeSubSolverstaysnullLayout comparison
Before/After Visual Demo
Before (PackSolver2): caps placed at arbitrary x/y positions, no stable order.
After (
createDecouplingCapsRowLayout):Tests
6 new tests in
tests/PackInnerPartitionsSolver/SingleInnerPartitionPackingSolver.test.ts:y=0, left-to-right orderC1 < C2 < C10(notC1 < C10 < C2)decouplingCapsGap=0.25chipGapwhendecouplingCapsGapabsent90/270rotation swaps width dimension correctlyactiveSubSolverisnull(PackSolver2 never runs)All 23 existing tests continue to pass.