@tscircuit/capacity-autorouter 0.0.150 → 0.0.152

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -7,6 +7,13 @@ type TraceId = string;
7
7
  type NetId = string;
8
8
  type PointId = string;
9
9
  type OffBoardConnectionId = string;
10
+ type ConnectionPoint = {
11
+ x: number;
12
+ y: number;
13
+ layer: string;
14
+ pointId?: PointId;
15
+ pcb_port_id?: string;
16
+ };
10
17
  interface SimpleRouteJson {
11
18
  layerCount: number;
12
19
  minTraceWidth: number;
@@ -44,13 +51,7 @@ interface SimpleRouteConnection {
44
51
  isOffBoard?: boolean;
45
52
  netConnectionName?: string;
46
53
  nominalTraceWidth?: number;
47
- pointsToConnect: Array<{
48
- x: number;
49
- y: number;
50
- layer: string;
51
- pointId?: PointId;
52
- pcb_port_id?: string;
53
- }>;
54
+ pointsToConnect: ConnectionPoint[];
54
55
  /** @deprecated DO NOT USE **/
55
56
  externallyConnectedPointIds?: PointId[][];
56
57
  }
@@ -1989,6 +1990,60 @@ declare class UselessViaRemovalSolver extends BaseSolver {
1989
1990
  visualize(): GraphicsObject;
1990
1991
  }
1991
1992
 
1993
+ /**
1994
+ * A Disjoint Set Union (DSU) or Union-Find data structure.
1995
+ * It tracks a collection of disjoint sets and can efficiently merge them.
1996
+ */
1997
+ declare class DSU {
1998
+ private parent;
1999
+ /**
2000
+ * Creates a new DSU instance.
2001
+ * Each ID is initially in its own set.
2002
+ */
2003
+ constructor(ids: string[]);
2004
+ /**
2005
+ * Finds the representative of the set containing the given ID.
2006
+ * Uses path compression.
2007
+ */
2008
+ find(id: string): string;
2009
+ /**
2010
+ * Merges the sets containing the two given IDs.
2011
+ */
2012
+ union(id1: string, id2: string): void;
2013
+ /**
2014
+ * Gets all IDs in the same set as the given ID.
2015
+ */
2016
+ getGroup(id: string): string[];
2017
+ }
2018
+
2019
+ /**
2020
+ * Extends the base NetToPointPairsSolver with an optimization that utilizes
2021
+ * off-board connections to find shorter routing paths.
2022
+ *
2023
+ * This solver preprocesses all connections to identify points that are
2024
+ * electrically connected off-board (via the `isOffBoard` flag). It builds
2025
+ * "equivalence groups" of these points using a Disjoint Set Union (DSU)
2026
+ * data structure.
2027
+ *
2028
+ * When the solver processes an on-board connection or a segment from a
2029
+ * Minimum Spanning Tree (MST), it checks if either of the connection's
2030
+ * endpoints has an off-board equivalent. If so, it calculates the distance
2031
+ * to all possible substitutes and chooses the pair that results in the
2032
+ * shortest path, potentially rerouting the connection to a more optimal
2033
+ * equivalent point.
2034
+ */
2035
+ declare class NetToPointPairsSolver2_OffBoardConnection extends NetToPointPairsSolver {
2036
+ ogSrj: SimpleRouteJson;
2037
+ colorMap: Record<string, string>;
2038
+ connectionPointDsu: DSU;
2039
+ connectionPointMap: Map<string, ConnectionPoint>;
2040
+ constructor(ogSrj: SimpleRouteJson, colorMap?: Record<string, string>);
2041
+ _findBestConnectionPointsFromDisjointSets(sourcePoint: ConnectionPoint, targetPoint: ConnectionPoint): {
2042
+ pointsToConnect: [ConnectionPoint, ConnectionPoint];
2043
+ };
2044
+ _step(): void;
2045
+ }
2046
+
1992
2047
  interface CapacityMeshSolverOptions$1 {
1993
2048
  capacityDepth?: number;
1994
2049
  targetMinCapacity?: number;
@@ -2034,7 +2089,7 @@ declare class AutoroutingPipelineSolver extends BaseSolver {
2034
2089
  capacityNodes: CapacityMeshNode[] | null;
2035
2090
  capacityEdges: CapacityMeshEdge[] | null;
2036
2091
  cacheProvider: CacheProvider | null;
2037
- pipelineDef: (PipelineStep$1<typeof NetToPointPairsSolver> | PipelineStep$1<typeof CapacityMeshNodeSolver2_NodeUnderObstacle> | PipelineStep$1<typeof SingleLayerNodeMergerSolver> | PipelineStep$1<typeof StrawSolver> | PipelineStep$1<typeof CapacityMeshEdgeSolver2_NodeTreeOptimization> | PipelineStep$1<typeof DeadEndSolver> | PipelineStep$1<typeof CapacityPathingGreedySolver> | PipelineStep$1<typeof CapacityPathingMultiSectionSolver> | PipelineStep$1<typeof CapacityEdgeToPortSegmentSolver> | PipelineStep$1<typeof CapacitySegmentToPointSolver> | PipelineStep$1<typeof UnravelMultiSectionSolver> | PipelineStep$1<typeof HighDensitySolver> | PipelineStep$1<typeof MultipleHighDensityRouteStitchSolver> | PipelineStep$1<typeof UselessViaRemovalSolver> | PipelineStep$1<typeof MultiSimplifiedPathSolver>)[];
2092
+ pipelineDef: (PipelineStep$1<typeof NetToPointPairsSolver2_OffBoardConnection> | PipelineStep$1<typeof CapacityMeshNodeSolver2_NodeUnderObstacle> | PipelineStep$1<typeof SingleLayerNodeMergerSolver> | PipelineStep$1<typeof StrawSolver> | PipelineStep$1<typeof CapacityMeshEdgeSolver2_NodeTreeOptimization> | PipelineStep$1<typeof DeadEndSolver> | PipelineStep$1<typeof CapacityPathingGreedySolver> | PipelineStep$1<typeof CapacityPathingMultiSectionSolver> | PipelineStep$1<typeof CapacityEdgeToPortSegmentSolver> | PipelineStep$1<typeof CapacitySegmentToPointSolver> | PipelineStep$1<typeof UnravelMultiSectionSolver> | PipelineStep$1<typeof HighDensitySolver> | PipelineStep$1<typeof MultipleHighDensityRouteStitchSolver> | PipelineStep$1<typeof UselessViaRemovalSolver> | PipelineStep$1<typeof MultiSimplifiedPathSolver>)[];
2038
2093
  constructor(srj: SimpleRouteJson, opts?: CapacityMeshSolverOptions$1);
2039
2094
  currentPipelineStepIndex: number;
2040
2095
  _step(): void;