@tscircuit/capacity-autorouter 0.0.52 → 0.0.54

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
@@ -1,3 +1,4 @@
1
+ import * as graphics_debug from 'graphics-debug';
1
2
  import { GraphicsObject } from 'graphics-debug';
2
3
  import { ConnectivityMap } from 'circuit-json-to-connectivity-map';
3
4
 
@@ -116,9 +117,11 @@ declare class BaseSolver {
116
117
  declare class CapacityMeshEdgeSolver extends BaseSolver {
117
118
  nodes: CapacityMeshNode[];
118
119
  edges: Array<CapacityMeshEdge>;
120
+ /** Only used for visualization, dynamically instantiated if necessary */
121
+ nodeMap?: Map<CapacityMeshNodeId, CapacityMeshNode>;
119
122
  constructor(nodes: CapacityMeshNode[]);
120
123
  getNextCapacityMeshEdgeId(): string;
121
- step(): void;
124
+ _step(): void;
122
125
  handleTargetNodes(): void;
123
126
  doNodesHaveSharedLayer(node1: CapacityMeshNode, node2: CapacityMeshNode): boolean;
124
127
  visualize(): GraphicsObject;
@@ -242,80 +245,6 @@ declare class CapacityMeshNodeSolver2_NodeUnderObstacle extends CapacityMeshNode
242
245
  _step(): void;
243
246
  }
244
247
 
245
- interface CapacityHyperParameters {
246
- VIA_DIAMETER: number;
247
- TRACE_WIDTH: number;
248
- MAX_CAPACITY_FACTOR: number;
249
- }
250
-
251
- type Candidate = {
252
- prevCandidate: Candidate | null;
253
- node: CapacityMeshNode;
254
- f: number;
255
- g: number;
256
- h: number;
257
- };
258
- declare class CapacityPathingSolver extends BaseSolver {
259
- connectionsWithNodes: Array<{
260
- connection: SimpleRouteConnection;
261
- nodes: CapacityMeshNode[];
262
- path?: CapacityMeshNode[];
263
- straightLineDistance: number;
264
- }>;
265
- usedNodeCapacityMap: Map<CapacityMeshNodeId, number>;
266
- simpleRouteJson: SimpleRouteJson;
267
- nodes: CapacityMeshNode[];
268
- edges: CapacityMeshEdge[];
269
- GREEDY_MULTIPLIER: number;
270
- nodeMap: Map<CapacityMeshNodeId, CapacityMeshNode>;
271
- nodeEdgeMap: Map<CapacityMeshNodeId, CapacityMeshEdge[]>;
272
- connectionNameToGoalNodeIds: Map<string, CapacityMeshNodeId[]>;
273
- colorMap: Record<string, string>;
274
- maxDepthOfNodes: number;
275
- activeCandidateStraightLineDistance?: number;
276
- debug_lastNodeCostMap: Map<CapacityMeshNodeId, {
277
- g: number;
278
- h: number;
279
- f: number;
280
- }>;
281
- hyperParameters: Partial<CapacityHyperParameters>;
282
- constructor({ simpleRouteJson, nodes, edges, colorMap, MAX_ITERATIONS, hyperParameters, }: {
283
- simpleRouteJson: SimpleRouteJson;
284
- nodes: CapacityMeshNode[];
285
- edges: CapacityMeshEdge[];
286
- colorMap?: Record<string, string>;
287
- MAX_ITERATIONS?: number;
288
- hyperParameters?: Partial<CapacityHyperParameters>;
289
- });
290
- getTotalCapacity(node: CapacityMeshNode): number;
291
- getConnectionsWithNodes(): {
292
- connectionsWithNodes: {
293
- connection: SimpleRouteConnection;
294
- nodes: CapacityMeshNode[];
295
- pathFound: boolean;
296
- straightLineDistance: number;
297
- }[];
298
- connectionNameToGoalNodeIds: Map<string, string[]>;
299
- };
300
- currentConnectionIndex: number;
301
- candidates?: Array<Candidate> | null;
302
- visitedNodes?: Set<CapacityMeshNodeId> | null;
303
- computeG(prevCandidate: Candidate, node: CapacityMeshNode, endGoal: CapacityMeshNode): number;
304
- computeH(prevCandidate: Candidate, node: CapacityMeshNode, endGoal: CapacityMeshNode): number;
305
- getBacktrackedPath(candidate: Candidate): CapacityMeshNode[];
306
- getNeighboringNodes(node: CapacityMeshNode): CapacityMeshNode[];
307
- getCapacityPaths(): CapacityPath[];
308
- doesNodeHaveCapacityForTrace(node: CapacityMeshNode, prevNode: CapacityMeshNode): boolean;
309
- canTravelThroughObstacle(node: CapacityMeshNode, connectionName: string): boolean;
310
- getDistanceBetweenNodes(A: CapacityMeshNode, B: CapacityMeshNode): number;
311
- reduceCapacityAlongPath(nextConnection: {
312
- path?: CapacityMeshNode[];
313
- }): void;
314
- isConnectedToEndGoal(node: CapacityMeshNode, endGoal: CapacityMeshNode): boolean;
315
- _step(): void;
316
- visualize(): GraphicsObject;
317
- }
318
-
319
248
  interface NodePortSegment {
320
249
  capacityMeshNodeId: string;
321
250
  nodePortSegmentId?: string;
@@ -370,6 +299,7 @@ type NodeWithPortPoints = {
370
299
  width: number;
371
300
  height: number;
372
301
  portPoints: PortPoint[];
302
+ availableZ?: number[];
373
303
  };
374
304
  /**
375
305
  * A path for a wire in high-density intra-node routing.
@@ -471,6 +401,8 @@ interface HighDensityHyperParameters {
471
401
  SHUFFLE_SEED: number;
472
402
  CELL_SIZE_FACTOR: number;
473
403
  FLIP_TRACE_ALIGNMENT_DIRECTION: boolean;
404
+ MULTI_HEAD_POLYLINE_SOLVER: boolean;
405
+ SEGMENTS_PER_POLYLINE: number;
474
406
  }
475
407
 
476
408
  type Node = {
@@ -482,9 +414,9 @@ type Node = {
482
414
  f: number;
483
415
  parent: Node | null;
484
416
  };
485
- declare class SingleRouteCandidatePriorityQueue {
417
+ declare class SingleRouteCandidatePriorityQueue<T extends Node = Node> {
486
418
  private heap;
487
- constructor(nodes: Node[]);
419
+ constructor(nodes: T[]);
488
420
  private getLeftChildIndex;
489
421
  private getRightChildIndex;
490
422
  private getParentIndex;
@@ -495,9 +427,9 @@ declare class SingleRouteCandidatePriorityQueue {
495
427
  private rightChild;
496
428
  private parent;
497
429
  private swap;
498
- dequeue(): Node | null;
499
- peek(): Node | null;
500
- enqueue(item: Node): void;
430
+ dequeue(): T | null;
431
+ peek(): T | null;
432
+ enqueue(item: T): void;
501
433
  heapifyUp(): void;
502
434
  heapifyDown(): void;
503
435
  }
@@ -700,6 +632,7 @@ declare class TwoCrossingRoutesHighDensitySolver extends BaseSolver {
700
632
  via1: Point$2;
701
633
  via2: Point$2;
702
634
  }[];
635
+ escapeLayer: number;
703
636
  solvedRoutes: HighDensityIntraNodeRoute$1[];
704
637
  bounds: {
705
638
  minX: number;
@@ -727,20 +660,14 @@ declare class TwoCrossingRoutesHighDensitySolver extends BaseSolver {
727
660
  */
728
661
  private doRoutesCross;
729
662
  private calculateViaPositions;
730
- /**
731
- * Create a route with properly placed vias
732
- */
733
- private createRoute;
734
663
  /**
735
664
  * Try to solve with routeA going over and routeB staying on layer 0
736
665
  */
737
666
  private trySolveAOverB;
738
- private optimizeViaPositions;
739
- /**
740
- * Calculate the orthogonal route points for the second route
741
- */
742
- private calculateConservativeOrthogonalRoutePoints;
743
- private calculateShortestOrthogonalRoutePoints;
667
+ private pushViasFromEndpoints;
668
+ private getMinDistanceBetweenViaCenters;
669
+ private moveViasAsCloseAsPossible;
670
+ handleRoutesDontCross(): void;
744
671
  /**
745
672
  * Main step method that attempts to solve the two crossing routes
746
673
  */
@@ -806,6 +733,12 @@ declare class HyperSingleIntraNodeSolver extends HyperParameterSupervisorSolver<
806
733
  CLOSED_FORM_TWO_TRACE_TRANSITION_CROSSING: boolean;
807
734
  CLOSED_FORM_TWO_TRACE_SAME_LAYER?: undefined;
808
735
  })[];
736
+ } | {
737
+ name: string;
738
+ possibleValues: {
739
+ MULTI_HEAD_POLYLINE_SOLVER: boolean;
740
+ SEGMENTS_PER_POLYLINE: number;
741
+ }[];
809
742
  })[];
810
743
  computeG(solver: IntraNodeRouteSolver): number;
811
744
  computeH(solver: IntraNodeRouteSolver): number;
@@ -1024,6 +957,7 @@ declare class SingleHighDensityRouteStitchSolver extends BaseSolver {
1024
957
  y: number;
1025
958
  z: number;
1026
959
  };
960
+ colorMap: Record<string, string>;
1027
961
  constructor(opts: {
1028
962
  connectionName?: string;
1029
963
  hdRoutes: HighDensityIntraNodeRoute$1[];
@@ -1037,6 +971,7 @@ declare class SingleHighDensityRouteStitchSolver extends BaseSolver {
1037
971
  y: number;
1038
972
  z: number;
1039
973
  };
974
+ colorMap?: Record<string, string>;
1040
975
  });
1041
976
  _step(): void;
1042
977
  visualize(): GraphicsObject;
@@ -1060,9 +995,11 @@ declare class MultipleHighDensityRouteStitchSolver extends BaseSolver {
1060
995
  unsolvedRoutes: UnsolvedRoute[];
1061
996
  activeSolver: SingleHighDensityRouteStitchSolver | null;
1062
997
  mergedHdRoutes: HighDensityIntraNodeRoute$1[];
998
+ colorMap: Record<string, string>;
1063
999
  constructor(opts: {
1064
1000
  connections: SimpleRouteConnection[];
1065
1001
  hdRoutes: HighDensityIntraNodeRoute$1[];
1002
+ colorMap?: Record<string, string>;
1066
1003
  layerCount: number;
1067
1004
  });
1068
1005
  _step(): void;
@@ -1124,6 +1061,7 @@ interface UnravelSection {
1124
1061
  mutableSegmentIds: Set<string>;
1125
1062
  immutableNodeIds: CapacityMeshNodeId[];
1126
1063
  segmentPointMap: SegmentPointMap;
1064
+ mutableSegmentPointIds: Set<SegmentPointId>;
1127
1065
  segmentPairsInNode: Map<CapacityMeshNodeId, Array<[SegmentPointId, SegmentPointId]>>;
1128
1066
  segmentPointsInNode: Map<CapacityMeshNodeId, SegmentPointId[]>;
1129
1067
  segmentPointsInSegment: Map<SegmentId, SegmentPointId[]>;
@@ -1186,6 +1124,19 @@ type SegmentPointMapAndReverseMaps = {
1186
1124
  segmentToSegmentPointMap: Map<SegmentId, SegmentPointId[]>;
1187
1125
  };
1188
1126
 
1127
+ interface UnravelSectionSolverParams {
1128
+ rootNodeId: CapacityMeshNodeId;
1129
+ colorMap?: Record<string, string>;
1130
+ MUTABLE_HOPS?: number;
1131
+ nodeMap: Map<CapacityMeshNodeId, CapacityMeshNode>;
1132
+ dedupedSegments: SegmentWithAssignedPoints[];
1133
+ dedupedSegmentMap?: Map<SegmentId, SegmentWithAssignedPoints>;
1134
+ nodeIdToSegmentIds: Map<CapacityMeshNodeId, CapacityMeshNodeId[]>;
1135
+ segmentIdToNodeIds: Map<CapacityMeshNodeId, CapacityMeshNodeId[]>;
1136
+ segmentPointMap?: SegmentPointMap;
1137
+ nodeToSegmentPointMap?: Map<CapacityMeshNodeId, SegmentPointId[]>;
1138
+ segmentToSegmentPointMap?: Map<SegmentId, SegmentPointId[]>;
1139
+ }
1189
1140
  /**
1190
1141
  * The UntangleSectionSolver optimizes a section of connected capacity nodes
1191
1142
  * with their deduplicated segments.
@@ -1232,19 +1183,9 @@ declare class UnravelSectionSolver extends BaseSolver {
1232
1183
  iterationsSinceImprovement: number;
1233
1184
  selectedCandidateIndex: number | "best" | "original" | null;
1234
1185
  queuedOrExploredCandidatePointModificationHashes: Set<string>;
1235
- constructor(params: {
1236
- rootNodeId: CapacityMeshNodeId;
1237
- colorMap?: Record<string, string>;
1238
- MUTABLE_HOPS?: number;
1239
- nodeMap: Map<CapacityMeshNodeId, CapacityMeshNode>;
1240
- dedupedSegments: SegmentWithAssignedPoints[];
1241
- dedupedSegmentMap?: Map<SegmentId, SegmentWithAssignedPoints>;
1242
- nodeIdToSegmentIds: Map<CapacityMeshNodeId, CapacityMeshNodeId[]>;
1243
- segmentIdToNodeIds: Map<CapacityMeshNodeId, CapacityMeshNodeId[]>;
1244
- segmentPointMap?: SegmentPointMap;
1245
- nodeToSegmentPointMap?: Map<CapacityMeshNodeId, SegmentPointId[]>;
1246
- segmentToSegmentPointMap?: Map<SegmentId, SegmentPointId[]>;
1247
- });
1186
+ constructorParams: UnravelSectionSolverParams;
1187
+ constructor(params: UnravelSectionSolverParams);
1188
+ getConstructorParams(): UnravelSectionSolverParams;
1248
1189
  createUnravelSection(largeSpMaps?: SegmentPointMapAndReverseMaps): UnravelSection;
1249
1190
  createInitialCandidate(): UnravelCandidate;
1250
1191
  get nextCandidate(): UnravelCandidate | null;
@@ -1281,12 +1222,13 @@ declare class UnravelMultiSectionSolver extends BaseSolver {
1281
1222
  MAX_NODE_ATTEMPTS: number;
1282
1223
  MUTABLE_HOPS: number;
1283
1224
  ACCEPTABLE_PF: number;
1225
+ MAX_ITERATIONS_WITHOUT_IMPROVEMENT: number;
1284
1226
  /**
1285
1227
  * Probability of failure for each node
1286
1228
  */
1287
1229
  nodePfMap: Map<CapacityMeshNodeId, number>;
1288
1230
  attemptsToFixNode: Map<CapacityMeshNodeId, number>;
1289
- activeSolver: UnravelSectionSolver | null;
1231
+ activeSubSolver: UnravelSectionSolver | null;
1290
1232
  segmentPointMap: SegmentPointMap;
1291
1233
  constructor({ assignedSegments, colorMap, nodes, }: {
1292
1234
  assignedSegments: NodePortSegment[];
@@ -1304,6 +1246,82 @@ declare class UnravelMultiSectionSolver extends BaseSolver {
1304
1246
  getNodesWithPortPoints(): NodeWithPortPoints[];
1305
1247
  }
1306
1248
 
1249
+ interface CapacityHyperParameters {
1250
+ VIA_DIAMETER: number;
1251
+ TRACE_WIDTH: number;
1252
+ MAX_CAPACITY_FACTOR: number;
1253
+ }
1254
+
1255
+ type Candidate$1 = {
1256
+ prevCandidate: Candidate$1 | null;
1257
+ node: CapacityMeshNode;
1258
+ f: number;
1259
+ g: number;
1260
+ h: number;
1261
+ };
1262
+ type ConnectionPathWithNodes = {
1263
+ connection: SimpleRouteConnection;
1264
+ nodes: CapacityMeshNode[];
1265
+ path?: CapacityMeshNode[];
1266
+ straightLineDistance: number;
1267
+ };
1268
+ declare class CapacityPathingSolver extends BaseSolver {
1269
+ connectionsWithNodes: Array<ConnectionPathWithNodes>;
1270
+ usedNodeCapacityMap: Map<CapacityMeshNodeId, number>;
1271
+ simpleRouteJson: SimpleRouteJson;
1272
+ nodes: CapacityMeshNode[];
1273
+ edges: CapacityMeshEdge[];
1274
+ GREEDY_MULTIPLIER: number;
1275
+ MAX_CANDIDATES_IN_MEMORY: number;
1276
+ nodeMap: Map<CapacityMeshNodeId, CapacityMeshNode>;
1277
+ nodeEdgeMap: Map<CapacityMeshNodeId, CapacityMeshEdge[]>;
1278
+ connectionNameToGoalNodeIds: Map<string, CapacityMeshNodeId[]>;
1279
+ colorMap: Record<string, string>;
1280
+ maxDepthOfNodes: number;
1281
+ activeCandidateStraightLineDistance?: number;
1282
+ debug_lastNodeCostMap: Map<CapacityMeshNodeId, {
1283
+ g: number;
1284
+ h: number;
1285
+ f: number;
1286
+ }>;
1287
+ hyperParameters: Partial<CapacityHyperParameters>;
1288
+ constructor({ simpleRouteJson, nodes, edges, colorMap, MAX_ITERATIONS, hyperParameters, }: {
1289
+ simpleRouteJson: SimpleRouteJson;
1290
+ nodes: CapacityMeshNode[];
1291
+ edges: CapacityMeshEdge[];
1292
+ colorMap?: Record<string, string>;
1293
+ MAX_ITERATIONS?: number;
1294
+ hyperParameters?: Partial<CapacityHyperParameters>;
1295
+ });
1296
+ getTotalCapacity(node: CapacityMeshNode): number;
1297
+ getConnectionsWithNodes(): {
1298
+ connectionsWithNodes: {
1299
+ connection: SimpleRouteConnection;
1300
+ nodes: CapacityMeshNode[];
1301
+ pathFound: boolean;
1302
+ straightLineDistance: number;
1303
+ }[];
1304
+ connectionNameToGoalNodeIds: Map<string, string[]>;
1305
+ };
1306
+ currentConnectionIndex: number;
1307
+ candidates?: Array<Candidate$1> | null;
1308
+ visitedNodes?: Set<CapacityMeshNodeId> | null;
1309
+ computeG(prevCandidate: Candidate$1, node: CapacityMeshNode, endGoal: CapacityMeshNode): number;
1310
+ computeH(prevCandidate: Candidate$1, node: CapacityMeshNode, endGoal: CapacityMeshNode): number;
1311
+ getBacktrackedPath(candidate: Candidate$1): CapacityMeshNode[];
1312
+ getNeighboringNodes(node: CapacityMeshNode): CapacityMeshNode[];
1313
+ getCapacityPaths(): CapacityPath[];
1314
+ doesNodeHaveCapacityForTrace(node: CapacityMeshNode, prevNode: CapacityMeshNode): boolean;
1315
+ canTravelThroughObstacle(node: CapacityMeshNode, connectionName: string): boolean;
1316
+ getDistanceBetweenNodes(A: CapacityMeshNode, B: CapacityMeshNode): number;
1317
+ reduceCapacityAlongPath(nextConnection: {
1318
+ path?: CapacityMeshNode[];
1319
+ }): void;
1320
+ isConnectedToEndGoal(node: CapacityMeshNode, endGoal: CapacityMeshNode): boolean;
1321
+ _step(): void;
1322
+ visualize(): GraphicsObject;
1323
+ }
1324
+
1307
1325
  declare class CapacityPathingSolver5 extends CapacityPathingSolver {
1308
1326
  NEGATIVE_CAPACITY_PENALTY_FACTOR: number;
1309
1327
  REDUCED_CAPACITY_PENALTY_FACTOR: number;
@@ -1320,8 +1338,159 @@ declare class CapacityPathingSolver5 extends CapacityPathingSolver {
1320
1338
  * To minimize shortest path, you'd want to comment this out.
1321
1339
  */
1322
1340
  getDistanceBetweenNodes(A: CapacityMeshNode, B: CapacityMeshNode): number;
1341
+ computeG(prevCandidate: Candidate$1, node: CapacityMeshNode, endGoal: CapacityMeshNode): number;
1342
+ computeH(prevCandidate: Candidate$1, node: CapacityMeshNode, endGoal: CapacityMeshNode): number;
1343
+ }
1344
+
1345
+ declare class CapacityPathingGreedySolver extends CapacityPathingSolver5 {
1346
+ doesNodeHaveCapacityForTrace(node: CapacityMeshNode, prevNode: CapacityMeshNode): boolean;
1347
+ getNodeCapacityPenalty(node: CapacityMeshNode): number;
1348
+ }
1349
+
1350
+ type Candidate = {
1351
+ prevCandidate: Candidate | null;
1352
+ node: CapacityMeshNode;
1353
+ f: number;
1354
+ g: number;
1355
+ h: number;
1356
+ };
1357
+ interface CpssPathingSolverHyperParameters {
1358
+ SHUFFLE_SEED?: number;
1359
+ EXPANSION_DEGREES?: number;
1360
+ }
1361
+ interface CapacityPathingSingleSectionPathingSolverParams {
1362
+ sectionNodes: CapacityMeshNode[];
1363
+ sectionEdges: CapacityMeshEdge[];
1364
+ sectionConnectionTerminals: Array<{
1365
+ connectionName: string;
1366
+ startNodeId: CapacityMeshNodeId;
1367
+ endNodeId: CapacityMeshNodeId;
1368
+ }>;
1369
+ colorMap?: Record<string, string>;
1370
+ hyperParameters?: CpssPathingSolverHyperParameters;
1371
+ }
1372
+ declare class CapacityPathingSingleSectionPathingSolver extends BaseSolver {
1373
+ GREEDY_MULTIPLIER: number;
1374
+ sectionNodes: CapacityMeshNode[];
1375
+ sectionEdges: CapacityMeshEdge[];
1376
+ sectionConnectionTerminals: Array<{
1377
+ connectionName: string;
1378
+ startNodeId: CapacityMeshNodeId;
1379
+ endNodeId: CapacityMeshNodeId;
1380
+ path?: CapacityMeshNode[];
1381
+ }>;
1382
+ nodeMap: Map<CapacityMeshNodeId, CapacityMeshNode>;
1383
+ nodeEdgeMap: Map<CapacityMeshNodeId, CapacityMeshEdge[]>;
1384
+ colorMap: Record<string, string>;
1385
+ usedNodeCapacityMap: Map<CapacityMeshNodeId, number>;
1386
+ MAX_CANDIDATES_IN_MEMORY: number;
1387
+ currentConnectionIndex: number;
1388
+ candidates?: Array<Candidate> | null;
1389
+ visitedNodes?: Set<CapacityMeshNodeId> | null;
1390
+ queuedNodes?: Set<CapacityMeshNodeId> | null;
1391
+ activeCandidateStraightLineDistance?: number;
1392
+ debug_lastNodeCostMap: Map<CapacityMeshNodeId, {
1393
+ g: number;
1394
+ h: number;
1395
+ f: number;
1396
+ }>;
1397
+ maxCapacityFactor: number;
1398
+ constructor(params: CapacityPathingSingleSectionPathingSolverParams);
1399
+ getTotalCapacity(node: CapacityMeshNode): number;
1400
+ getNodeCapacityPenalty(node: CapacityMeshNode): number;
1401
+ getDistanceBetweenNodes(A: CapacityMeshNode, B: CapacityMeshNode): number;
1323
1402
  computeG(prevCandidate: Candidate, node: CapacityMeshNode, endGoal: CapacityMeshNode): number;
1324
- computeH(prevCandidate: Candidate, node: CapacityMeshNode, endGoal: CapacityMeshNode): number;
1403
+ computeH(prevCandidate: Candidate, // prevCandidate not strictly needed here
1404
+ node: CapacityMeshNode, endGoal: CapacityMeshNode): number;
1405
+ getBacktrackedPath(candidate: Candidate): CapacityMeshNode[];
1406
+ getNeighboringNodes(node: CapacityMeshNode): CapacityMeshNode[];
1407
+ isConnectedToEndGoal(node: CapacityMeshNode, endGoal: CapacityMeshNode): boolean;
1408
+ doesNodeHaveCapacityForTrace(node: CapacityMeshNode, prevNode: CapacityMeshNode | null): boolean;
1409
+ reduceCapacityAlongPath(path: CapacityMeshNode[]): void;
1410
+ _step(): void;
1411
+ private _setupAStar;
1412
+ private _handleCandidatesExhausted;
1413
+ private _handleGoalReached;
1414
+ visualize(): GraphicsObject;
1415
+ }
1416
+
1417
+ interface CapacityPathingSingleSectionSolverInput {
1418
+ centerNodeId: CapacityMeshNodeId;
1419
+ connectionsWithNodes: Array<ConnectionPathWithNodes>;
1420
+ nodes: CapacityMeshNode[];
1421
+ edges: CapacityMeshEdge[];
1422
+ colorMap: Record<string, string>;
1423
+ hyperParameters?: CpssPathingSolverHyperParameters;
1424
+ }
1425
+ declare class CapacityPathingSingleSectionSolver extends BaseSolver {
1426
+ centerNodeId: CapacityMeshNodeId;
1427
+ connectionsWithNodes: Array<ConnectionPathWithNodes>;
1428
+ nodes: CapacityMeshNode[];
1429
+ nodeMap: Map<CapacityMeshNodeId, CapacityMeshNode>;
1430
+ edges: CapacityMeshEdge[];
1431
+ nodeEdgeMap: Map<CapacityMeshNodeId, CapacityMeshEdge[]>;
1432
+ expansionDegrees: number;
1433
+ colorMap: Record<string, string>;
1434
+ sectionNodes: CapacityMeshNode[];
1435
+ sectionEdges: CapacityMeshEdge[];
1436
+ sectionConnectionTerminals: Array<{
1437
+ connectionName: string;
1438
+ startNodeId: CapacityMeshNodeId;
1439
+ endNodeId: CapacityMeshNodeId;
1440
+ }>;
1441
+ activeSubSolver?: CapacityPathingSingleSectionPathingSolver | null | undefined;
1442
+ constructor(params: CapacityPathingSingleSectionSolverInput);
1443
+ private computeSectionNodesTerminalsAndEdges;
1444
+ _step(): void;
1445
+ getConstructorParams(): readonly [{
1446
+ readonly centerNodeId: string;
1447
+ readonly connectionsWithNodes: ConnectionPathWithNodes[];
1448
+ readonly nodes: CapacityMeshNode[];
1449
+ readonly edges: CapacityMeshEdge[];
1450
+ readonly expansionDegrees: number;
1451
+ }];
1452
+ visualize(): GraphicsObject;
1453
+ }
1454
+
1455
+ /**
1456
+ * This solver solves for capacity paths by first solving with negative
1457
+ * capacities allowed, then re-solving problematic sections with a section
1458
+ * solver.
1459
+ */
1460
+ declare class CapacityPathingMultiSectionSolver extends BaseSolver {
1461
+ simpleRouteJson: SimpleRouteJson;
1462
+ nodes: CapacityMeshNode[];
1463
+ edges: CapacityMeshEdge[];
1464
+ connectionsWithNodes: Array<ConnectionPathWithNodes>;
1465
+ colorMap: Record<string, string>;
1466
+ initialSolver: CapacityPathingGreedySolver;
1467
+ stage: "initialization" | "section-optimization";
1468
+ nodeMap: Map<CapacityMeshNodeId, CapacityMeshNode>;
1469
+ usedNodeCapacityMap: Map<CapacityMeshNodeId, number>;
1470
+ totalNodeCapacityMap: Map<CapacityMeshNodeId, number>;
1471
+ nodeCapacityPercentMap: Map<CapacityMeshNodeId, number>;
1472
+ nodeOptimizationAttemptCountMap: Map<CapacityMeshNodeId, number>;
1473
+ sectionSolver?: CapacityPathingSingleSectionSolver | null;
1474
+ MAX_ATTEMPTS_PER_NODE: number;
1475
+ MINIMUM_PROBABILITY_OF_FAILURE_TO_OPTIMIZE: number;
1476
+ MAX_EXPANSION_DEGREES: number;
1477
+ constructor(params: ConstructorParameters<typeof CapacityPathingSolver>[0]);
1478
+ _stepInitialization(): void;
1479
+ _getNextNodeToOptimize(): CapacityMeshNodeId | null;
1480
+ _stepSectionOptimization(): void;
1481
+ /**
1482
+ * Merges the paths found by a successful section solver back into the main
1483
+ * connectionsWithNodes list.
1484
+ */
1485
+ private _mergeSolvedSectionPaths;
1486
+ /**
1487
+ * Recalculates node capacity usage based on the current connectionsWithNodes
1488
+ * and updates the nodeCapacityPercentMap.
1489
+ */
1490
+ private _recalculateNodeCapacityUsage;
1491
+ getCapacityPaths(): CapacityPath[];
1492
+ _step(): void;
1493
+ visualize(): graphics_debug.GraphicsObject;
1325
1494
  }
1326
1495
 
1327
1496
  declare class StrawSolver extends BaseSolver {
@@ -1430,7 +1599,12 @@ declare class MultiSimplifiedPathSolver extends BaseSolver {
1430
1599
  }
1431
1600
 
1432
1601
  declare class CapacityMeshEdgeSolver2_NodeTreeOptimization extends CapacityMeshEdgeSolver {
1433
- step(): void;
1602
+ nodes: CapacityMeshNode[];
1603
+ private nodeTree;
1604
+ private currentNodeIndex;
1605
+ private edgeSet;
1606
+ constructor(nodes: CapacityMeshNode[]);
1607
+ _step(): void;
1434
1608
  }
1435
1609
 
1436
1610
  interface Point {
@@ -1514,6 +1688,11 @@ declare class SingleRouteUselessViaRemovalSolver extends BaseSolver {
1514
1688
  currentSection: RouteSection;
1515
1689
  targetZ: number;
1516
1690
  }): boolean;
1691
+ getConstructorParams(): {
1692
+ obstacleSHI: ObstacleSpatialHashIndex;
1693
+ hdRouteSHI: HighDensityRouteSpatialIndex;
1694
+ unsimplifiedRoute: HighDensityIntraNodeRoute;
1695
+ };
1517
1696
  getOptimizedHdRoute(): HighDensityRoute;
1518
1697
  visualize(): GraphicsObject;
1519
1698
  }
@@ -1555,7 +1734,7 @@ declare class AutoroutingPipelineSolver extends BaseSolver {
1555
1734
  nodeSolver?: CapacityMeshNodeSolver;
1556
1735
  nodeTargetMerger?: CapacityNodeTargetMerger;
1557
1736
  edgeSolver?: CapacityMeshEdgeSolver;
1558
- pathingSolver?: CapacityPathingSolver;
1737
+ pathingSolver?: CapacityPathingMultiSectionSolver;
1559
1738
  edgeToPortSegmentSolver?: CapacityEdgeToPortSegmentSolver;
1560
1739
  colorMap: Record<string, string>;
1561
1740
  segmentToPointSolver?: CapacitySegmentToPointSolver;
@@ -1565,8 +1744,10 @@ declare class AutoroutingPipelineSolver extends BaseSolver {
1565
1744
  highDensityStitchSolver?: MultipleHighDensityRouteStitchSolver;
1566
1745
  singleLayerNodeMerger?: SingleLayerNodeMergerSolver;
1567
1746
  strawSolver?: StrawSolver;
1568
- uselessViaRemovalSolver?: UselessViaRemovalSolver;
1569
- multiSimplifiedPathSolver?: MultiSimplifiedPathSolver;
1747
+ uselessViaRemovalSolver1?: UselessViaRemovalSolver;
1748
+ uselessViaRemovalSolver2?: UselessViaRemovalSolver;
1749
+ multiSimplifiedPathSolver1?: MultiSimplifiedPathSolver;
1750
+ multiSimplifiedPathSolver2?: MultiSimplifiedPathSolver;
1570
1751
  startTimeOfPhase: Record<string, number>;
1571
1752
  endTimeOfPhase: Record<string, number>;
1572
1753
  timeSpentOnPhase: Record<string, number>;
@@ -1574,7 +1755,7 @@ declare class AutoroutingPipelineSolver extends BaseSolver {
1574
1755
  connMap: ConnectivityMap;
1575
1756
  srjWithPointPairs?: SimpleRouteJson;
1576
1757
  capacityNodes: CapacityMeshNode[] | null;
1577
- pipelineDef: (PipelineStep<typeof NetToPointPairsSolver> | PipelineStep<typeof CapacityMeshNodeSolver2_NodeUnderObstacle> | PipelineStep<typeof SingleLayerNodeMergerSolver> | PipelineStep<typeof StrawSolver> | PipelineStep<typeof CapacityMeshEdgeSolver2_NodeTreeOptimization> | PipelineStep<typeof CapacityPathingSolver5> | PipelineStep<typeof CapacityEdgeToPortSegmentSolver> | PipelineStep<typeof CapacitySegmentToPointSolver> | PipelineStep<typeof UnravelMultiSectionSolver> | PipelineStep<typeof HighDensitySolver> | PipelineStep<typeof MultipleHighDensityRouteStitchSolver> | PipelineStep<typeof UselessViaRemovalSolver> | PipelineStep<typeof MultiSimplifiedPathSolver>)[];
1758
+ pipelineDef: (PipelineStep<typeof NetToPointPairsSolver> | PipelineStep<typeof CapacityMeshNodeSolver2_NodeUnderObstacle> | PipelineStep<typeof SingleLayerNodeMergerSolver> | PipelineStep<typeof StrawSolver> | PipelineStep<typeof CapacityMeshEdgeSolver2_NodeTreeOptimization> | PipelineStep<typeof CapacityPathingMultiSectionSolver> | PipelineStep<typeof CapacityEdgeToPortSegmentSolver> | PipelineStep<typeof CapacitySegmentToPointSolver> | PipelineStep<typeof UnravelMultiSectionSolver> | PipelineStep<typeof HighDensitySolver> | PipelineStep<typeof MultipleHighDensityRouteStitchSolver> | PipelineStep<typeof UselessViaRemovalSolver> | PipelineStep<typeof MultiSimplifiedPathSolver>)[];
1578
1759
  constructor(srj: SimpleRouteJson, opts?: CapacityMeshSolverOptions);
1579
1760
  currentPipelineStepIndex: number;
1580
1761
  _step(): void;
@@ -1620,6 +1801,7 @@ type CapacityMeshSolver = AutoroutingPipelineSolver;
1620
1801
  */
1621
1802
  declare const getTunedTotalCapacity1: (nodeOrWidth: CapacityMeshNode | {
1622
1803
  width: number;
1804
+ availableZ?: number[];
1623
1805
  }, maxCapacityFactor?: number) => number;
1624
1806
  /**
1625
1807
  * Calculate the optimal subdivision depth to reach a target minimum capacity