@tscircuit/capacity-autorouter 0.0.53 → 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 +47 -24
- package/dist/index.js +7818 -4462
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -117,9 +117,11 @@ declare class BaseSolver {
|
|
|
117
117
|
declare class CapacityMeshEdgeSolver extends BaseSolver {
|
|
118
118
|
nodes: CapacityMeshNode[];
|
|
119
119
|
edges: Array<CapacityMeshEdge>;
|
|
120
|
+
/** Only used for visualization, dynamically instantiated if necessary */
|
|
121
|
+
nodeMap?: Map<CapacityMeshNodeId, CapacityMeshNode>;
|
|
120
122
|
constructor(nodes: CapacityMeshNode[]);
|
|
121
123
|
getNextCapacityMeshEdgeId(): string;
|
|
122
|
-
|
|
124
|
+
_step(): void;
|
|
123
125
|
handleTargetNodes(): void;
|
|
124
126
|
doNodesHaveSharedLayer(node1: CapacityMeshNode, node2: CapacityMeshNode): boolean;
|
|
125
127
|
visualize(): GraphicsObject;
|
|
@@ -297,6 +299,7 @@ type NodeWithPortPoints = {
|
|
|
297
299
|
width: number;
|
|
298
300
|
height: number;
|
|
299
301
|
portPoints: PortPoint[];
|
|
302
|
+
availableZ?: number[];
|
|
300
303
|
};
|
|
301
304
|
/**
|
|
302
305
|
* A path for a wire in high-density intra-node routing.
|
|
@@ -398,6 +401,8 @@ interface HighDensityHyperParameters {
|
|
|
398
401
|
SHUFFLE_SEED: number;
|
|
399
402
|
CELL_SIZE_FACTOR: number;
|
|
400
403
|
FLIP_TRACE_ALIGNMENT_DIRECTION: boolean;
|
|
404
|
+
MULTI_HEAD_POLYLINE_SOLVER: boolean;
|
|
405
|
+
SEGMENTS_PER_POLYLINE: number;
|
|
401
406
|
}
|
|
402
407
|
|
|
403
408
|
type Node = {
|
|
@@ -409,9 +414,9 @@ type Node = {
|
|
|
409
414
|
f: number;
|
|
410
415
|
parent: Node | null;
|
|
411
416
|
};
|
|
412
|
-
declare class SingleRouteCandidatePriorityQueue {
|
|
417
|
+
declare class SingleRouteCandidatePriorityQueue<T extends Node = Node> {
|
|
413
418
|
private heap;
|
|
414
|
-
constructor(nodes:
|
|
419
|
+
constructor(nodes: T[]);
|
|
415
420
|
private getLeftChildIndex;
|
|
416
421
|
private getRightChildIndex;
|
|
417
422
|
private getParentIndex;
|
|
@@ -422,9 +427,9 @@ declare class SingleRouteCandidatePriorityQueue {
|
|
|
422
427
|
private rightChild;
|
|
423
428
|
private parent;
|
|
424
429
|
private swap;
|
|
425
|
-
dequeue():
|
|
426
|
-
peek():
|
|
427
|
-
enqueue(item:
|
|
430
|
+
dequeue(): T | null;
|
|
431
|
+
peek(): T | null;
|
|
432
|
+
enqueue(item: T): void;
|
|
428
433
|
heapifyUp(): void;
|
|
429
434
|
heapifyDown(): void;
|
|
430
435
|
}
|
|
@@ -728,6 +733,12 @@ declare class HyperSingleIntraNodeSolver extends HyperParameterSupervisorSolver<
|
|
|
728
733
|
CLOSED_FORM_TWO_TRACE_TRANSITION_CROSSING: boolean;
|
|
729
734
|
CLOSED_FORM_TWO_TRACE_SAME_LAYER?: undefined;
|
|
730
735
|
})[];
|
|
736
|
+
} | {
|
|
737
|
+
name: string;
|
|
738
|
+
possibleValues: {
|
|
739
|
+
MULTI_HEAD_POLYLINE_SOLVER: boolean;
|
|
740
|
+
SEGMENTS_PER_POLYLINE: number;
|
|
741
|
+
}[];
|
|
731
742
|
})[];
|
|
732
743
|
computeG(solver: IntraNodeRouteSolver): number;
|
|
733
744
|
computeH(solver: IntraNodeRouteSolver): number;
|
|
@@ -1050,6 +1061,7 @@ interface UnravelSection {
|
|
|
1050
1061
|
mutableSegmentIds: Set<string>;
|
|
1051
1062
|
immutableNodeIds: CapacityMeshNodeId[];
|
|
1052
1063
|
segmentPointMap: SegmentPointMap;
|
|
1064
|
+
mutableSegmentPointIds: Set<SegmentPointId>;
|
|
1053
1065
|
segmentPairsInNode: Map<CapacityMeshNodeId, Array<[SegmentPointId, SegmentPointId]>>;
|
|
1054
1066
|
segmentPointsInNode: Map<CapacityMeshNodeId, SegmentPointId[]>;
|
|
1055
1067
|
segmentPointsInSegment: Map<SegmentId, SegmentPointId[]>;
|
|
@@ -1112,6 +1124,19 @@ type SegmentPointMapAndReverseMaps = {
|
|
|
1112
1124
|
segmentToSegmentPointMap: Map<SegmentId, SegmentPointId[]>;
|
|
1113
1125
|
};
|
|
1114
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
|
+
}
|
|
1115
1140
|
/**
|
|
1116
1141
|
* The UntangleSectionSolver optimizes a section of connected capacity nodes
|
|
1117
1142
|
* with their deduplicated segments.
|
|
@@ -1158,19 +1183,9 @@ declare class UnravelSectionSolver extends BaseSolver {
|
|
|
1158
1183
|
iterationsSinceImprovement: number;
|
|
1159
1184
|
selectedCandidateIndex: number | "best" | "original" | null;
|
|
1160
1185
|
queuedOrExploredCandidatePointModificationHashes: Set<string>;
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
MUTABLE_HOPS?: number;
|
|
1165
|
-
nodeMap: Map<CapacityMeshNodeId, CapacityMeshNode>;
|
|
1166
|
-
dedupedSegments: SegmentWithAssignedPoints[];
|
|
1167
|
-
dedupedSegmentMap?: Map<SegmentId, SegmentWithAssignedPoints>;
|
|
1168
|
-
nodeIdToSegmentIds: Map<CapacityMeshNodeId, CapacityMeshNodeId[]>;
|
|
1169
|
-
segmentIdToNodeIds: Map<CapacityMeshNodeId, CapacityMeshNodeId[]>;
|
|
1170
|
-
segmentPointMap?: SegmentPointMap;
|
|
1171
|
-
nodeToSegmentPointMap?: Map<CapacityMeshNodeId, SegmentPointId[]>;
|
|
1172
|
-
segmentToSegmentPointMap?: Map<SegmentId, SegmentPointId[]>;
|
|
1173
|
-
});
|
|
1186
|
+
constructorParams: UnravelSectionSolverParams;
|
|
1187
|
+
constructor(params: UnravelSectionSolverParams);
|
|
1188
|
+
getConstructorParams(): UnravelSectionSolverParams;
|
|
1174
1189
|
createUnravelSection(largeSpMaps?: SegmentPointMapAndReverseMaps): UnravelSection;
|
|
1175
1190
|
createInitialCandidate(): UnravelCandidate;
|
|
1176
1191
|
get nextCandidate(): UnravelCandidate | null;
|
|
@@ -1207,12 +1222,13 @@ declare class UnravelMultiSectionSolver extends BaseSolver {
|
|
|
1207
1222
|
MAX_NODE_ATTEMPTS: number;
|
|
1208
1223
|
MUTABLE_HOPS: number;
|
|
1209
1224
|
ACCEPTABLE_PF: number;
|
|
1225
|
+
MAX_ITERATIONS_WITHOUT_IMPROVEMENT: number;
|
|
1210
1226
|
/**
|
|
1211
1227
|
* Probability of failure for each node
|
|
1212
1228
|
*/
|
|
1213
1229
|
nodePfMap: Map<CapacityMeshNodeId, number>;
|
|
1214
1230
|
attemptsToFixNode: Map<CapacityMeshNodeId, number>;
|
|
1215
|
-
|
|
1231
|
+
activeSubSolver: UnravelSectionSolver | null;
|
|
1216
1232
|
segmentPointMap: SegmentPointMap;
|
|
1217
1233
|
constructor({ assignedSegments, colorMap, nodes, }: {
|
|
1218
1234
|
assignedSegments: NodePortSegment[];
|
|
@@ -1256,6 +1272,7 @@ declare class CapacityPathingSolver extends BaseSolver {
|
|
|
1256
1272
|
nodes: CapacityMeshNode[];
|
|
1257
1273
|
edges: CapacityMeshEdge[];
|
|
1258
1274
|
GREEDY_MULTIPLIER: number;
|
|
1275
|
+
MAX_CANDIDATES_IN_MEMORY: number;
|
|
1259
1276
|
nodeMap: Map<CapacityMeshNodeId, CapacityMeshNode>;
|
|
1260
1277
|
nodeEdgeMap: Map<CapacityMeshNodeId, CapacityMeshEdge[]>;
|
|
1261
1278
|
connectionNameToGoalNodeIds: Map<string, CapacityMeshNodeId[]>;
|
|
@@ -1354,8 +1371,6 @@ interface CapacityPathingSingleSectionPathingSolverParams {
|
|
|
1354
1371
|
}
|
|
1355
1372
|
declare class CapacityPathingSingleSectionPathingSolver extends BaseSolver {
|
|
1356
1373
|
GREEDY_MULTIPLIER: number;
|
|
1357
|
-
NEGATIVE_CAPACITY_PENALTY_FACTOR: number;
|
|
1358
|
-
REDUCED_CAPACITY_PENALTY_FACTOR: number;
|
|
1359
1374
|
sectionNodes: CapacityMeshNode[];
|
|
1360
1375
|
sectionEdges: CapacityMeshEdge[];
|
|
1361
1376
|
sectionConnectionTerminals: Array<{
|
|
@@ -1368,6 +1383,7 @@ declare class CapacityPathingSingleSectionPathingSolver extends BaseSolver {
|
|
|
1368
1383
|
nodeEdgeMap: Map<CapacityMeshNodeId, CapacityMeshEdge[]>;
|
|
1369
1384
|
colorMap: Record<string, string>;
|
|
1370
1385
|
usedNodeCapacityMap: Map<CapacityMeshNodeId, number>;
|
|
1386
|
+
MAX_CANDIDATES_IN_MEMORY: number;
|
|
1371
1387
|
currentConnectionIndex: number;
|
|
1372
1388
|
candidates?: Array<Candidate> | null;
|
|
1373
1389
|
visitedNodes?: Set<CapacityMeshNodeId> | null;
|
|
@@ -1456,6 +1472,8 @@ declare class CapacityPathingMultiSectionSolver extends BaseSolver {
|
|
|
1456
1472
|
nodeOptimizationAttemptCountMap: Map<CapacityMeshNodeId, number>;
|
|
1457
1473
|
sectionSolver?: CapacityPathingSingleSectionSolver | null;
|
|
1458
1474
|
MAX_ATTEMPTS_PER_NODE: number;
|
|
1475
|
+
MINIMUM_PROBABILITY_OF_FAILURE_TO_OPTIMIZE: number;
|
|
1476
|
+
MAX_EXPANSION_DEGREES: number;
|
|
1459
1477
|
constructor(params: ConstructorParameters<typeof CapacityPathingSolver>[0]);
|
|
1460
1478
|
_stepInitialization(): void;
|
|
1461
1479
|
_getNextNodeToOptimize(): CapacityMeshNodeId | null;
|
|
@@ -1581,7 +1599,12 @@ declare class MultiSimplifiedPathSolver extends BaseSolver {
|
|
|
1581
1599
|
}
|
|
1582
1600
|
|
|
1583
1601
|
declare class CapacityMeshEdgeSolver2_NodeTreeOptimization extends CapacityMeshEdgeSolver {
|
|
1584
|
-
|
|
1602
|
+
nodes: CapacityMeshNode[];
|
|
1603
|
+
private nodeTree;
|
|
1604
|
+
private currentNodeIndex;
|
|
1605
|
+
private edgeSet;
|
|
1606
|
+
constructor(nodes: CapacityMeshNode[]);
|
|
1607
|
+
_step(): void;
|
|
1585
1608
|
}
|
|
1586
1609
|
|
|
1587
1610
|
interface Point {
|
|
@@ -1732,7 +1755,7 @@ declare class AutoroutingPipelineSolver extends BaseSolver {
|
|
|
1732
1755
|
connMap: ConnectivityMap;
|
|
1733
1756
|
srjWithPointPairs?: SimpleRouteJson;
|
|
1734
1757
|
capacityNodes: CapacityMeshNode[] | null;
|
|
1735
|
-
pipelineDef: (PipelineStep<typeof NetToPointPairsSolver> | PipelineStep<typeof CapacityMeshNodeSolver2_NodeUnderObstacle> | PipelineStep<typeof SingleLayerNodeMergerSolver> | PipelineStep<typeof StrawSolver> | PipelineStep<typeof CapacityMeshEdgeSolver2_NodeTreeOptimization> | PipelineStep<typeof
|
|
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>)[];
|
|
1736
1759
|
constructor(srj: SimpleRouteJson, opts?: CapacityMeshSolverOptions);
|
|
1737
1760
|
currentPipelineStepIndex: number;
|
|
1738
1761
|
_step(): void;
|