@tscircuit/capacity-autorouter 0.0.57 → 0.0.59
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 +28 -1
- package/dist/index.js +697 -12
- package/dist/index.js.map +1 -1
- package/package.json +7 -2
package/dist/index.d.ts
CHANGED
|
@@ -102,6 +102,12 @@ declare class BaseSolver {
|
|
|
102
102
|
failedSubSolvers?: BaseSolver[];
|
|
103
103
|
timeToSolve?: number;
|
|
104
104
|
stats: Record<string, number>;
|
|
105
|
+
/**
|
|
106
|
+
* For cached solvers
|
|
107
|
+
**/
|
|
108
|
+
cacheHit?: boolean;
|
|
109
|
+
cacheKey?: string;
|
|
110
|
+
cacheToSolveSpaceTransform?: any;
|
|
105
111
|
/** DO NOT OVERRIDE! Override _step() instead */
|
|
106
112
|
step(): void;
|
|
107
113
|
_step(): void;
|
|
@@ -1146,6 +1152,9 @@ type SegmentPointMapAndReverseMaps = {
|
|
|
1146
1152
|
segmentToSegmentPointMap: Map<SegmentId, SegmentPointId[]>;
|
|
1147
1153
|
};
|
|
1148
1154
|
|
|
1155
|
+
interface UnravelSectionHyperParameters {
|
|
1156
|
+
MAX_ITERATIONS_WITHOUT_IMPROVEMENT: number;
|
|
1157
|
+
}
|
|
1149
1158
|
interface UnravelSectionSolverParams {
|
|
1150
1159
|
rootNodeId: CapacityMeshNodeId;
|
|
1151
1160
|
colorMap?: Record<string, string>;
|
|
@@ -1158,6 +1167,7 @@ interface UnravelSectionSolverParams {
|
|
|
1158
1167
|
segmentPointMap?: SegmentPointMap;
|
|
1159
1168
|
nodeToSegmentPointMap?: Map<CapacityMeshNodeId, SegmentPointId[]>;
|
|
1160
1169
|
segmentToSegmentPointMap?: Map<SegmentId, SegmentPointId[]>;
|
|
1170
|
+
hyperParameters?: Partial<UnravelSectionHyperParameters>;
|
|
1161
1171
|
}
|
|
1162
1172
|
/**
|
|
1163
1173
|
* The UntangleSectionSolver optimizes a section of connected capacity nodes
|
|
@@ -1203,6 +1213,7 @@ declare class UnravelSectionSolver extends BaseSolver {
|
|
|
1203
1213
|
tunedNodeCapacityMap: Map<CapacityMeshNodeId, number>;
|
|
1204
1214
|
MAX_CANDIDATES: number;
|
|
1205
1215
|
iterationsSinceImprovement: number;
|
|
1216
|
+
hyperParameters: UnravelSectionHyperParameters;
|
|
1206
1217
|
selectedCandidateIndex: number | "best" | "original" | null;
|
|
1207
1218
|
queuedOrExploredCandidatePointModificationHashes: Set<string>;
|
|
1208
1219
|
constructorParams: UnravelSectionSolverParams;
|
|
@@ -1231,6 +1242,17 @@ declare class UnravelSectionSolver extends BaseSolver {
|
|
|
1231
1242
|
visualize(): GraphicsObject;
|
|
1232
1243
|
}
|
|
1233
1244
|
|
|
1245
|
+
interface CacheProvider {
|
|
1246
|
+
isSyncCache: boolean;
|
|
1247
|
+
cacheHits: number;
|
|
1248
|
+
cacheMisses: number;
|
|
1249
|
+
getCachedSolutionSync(cacheKey: string): any;
|
|
1250
|
+
getCachedSolution(cacheKey: string): Promise<any>;
|
|
1251
|
+
setCachedSolutionSync(cacheKey: string, cachedSolution: any): void;
|
|
1252
|
+
setCachedSolution(cacheKey: string, cachedSolution: any): Promise<void>;
|
|
1253
|
+
clearCache(): void;
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1234
1256
|
declare class UnravelMultiSectionSolver extends BaseSolver {
|
|
1235
1257
|
nodeMap: Map<CapacityMeshNodeId, CapacityMeshNode>;
|
|
1236
1258
|
dedupedSegmentMap: Map<SegmentId, SegmentWithAssignedPoints>;
|
|
@@ -1252,7 +1274,8 @@ declare class UnravelMultiSectionSolver extends BaseSolver {
|
|
|
1252
1274
|
attemptsToFixNode: Map<CapacityMeshNodeId, number>;
|
|
1253
1275
|
activeSubSolver: UnravelSectionSolver | null;
|
|
1254
1276
|
segmentPointMap: SegmentPointMap;
|
|
1255
|
-
|
|
1277
|
+
cacheProvider: CacheProvider | null;
|
|
1278
|
+
constructor({ assignedSegments, colorMap, nodes, cacheProvider, }: {
|
|
1256
1279
|
assignedSegments: NodePortSegment[];
|
|
1257
1280
|
colorMap?: Record<string, string>;
|
|
1258
1281
|
/**
|
|
@@ -1260,6 +1283,7 @@ declare class UnravelMultiSectionSolver extends BaseSolver {
|
|
|
1260
1283
|
* for the result datatype (the center, width, height of the node)
|
|
1261
1284
|
*/
|
|
1262
1285
|
nodes: CapacityMeshNode[];
|
|
1286
|
+
cacheProvider?: CacheProvider | null;
|
|
1263
1287
|
});
|
|
1264
1288
|
computeInitialPfMap(): Map<string, number>;
|
|
1265
1289
|
computeNodePf(node: CapacityMeshNode): number;
|
|
@@ -1390,6 +1414,7 @@ interface CapacityPathingSingleSectionPathingSolverParams {
|
|
|
1390
1414
|
}>;
|
|
1391
1415
|
colorMap?: Record<string, string>;
|
|
1392
1416
|
centerNodeId: string;
|
|
1417
|
+
nodeEdgeMap?: Map<CapacityMeshNodeId, CapacityMeshEdge[]>;
|
|
1393
1418
|
hyperParameters?: CpssPathingSolverHyperParameters;
|
|
1394
1419
|
}
|
|
1395
1420
|
declare class CapacityPathingSingleSectionSolver extends BaseSolver {
|
|
@@ -1752,6 +1777,7 @@ declare class UselessViaRemovalSolver extends BaseSolver {
|
|
|
1752
1777
|
interface CapacityMeshSolverOptions {
|
|
1753
1778
|
capacityDepth?: number;
|
|
1754
1779
|
targetMinCapacity?: number;
|
|
1780
|
+
cacheProvider?: CacheProvider | null;
|
|
1755
1781
|
}
|
|
1756
1782
|
type PipelineStep<T extends new (...args: any[]) => BaseSolver> = {
|
|
1757
1783
|
solverName: string;
|
|
@@ -1788,6 +1814,7 @@ declare class AutoroutingPipelineSolver extends BaseSolver {
|
|
|
1788
1814
|
connMap: ConnectivityMap;
|
|
1789
1815
|
srjWithPointPairs?: SimpleRouteJson;
|
|
1790
1816
|
capacityNodes: CapacityMeshNode[] | null;
|
|
1817
|
+
cacheProvider: CacheProvider | null;
|
|
1791
1818
|
pipelineDef: (PipelineStep<typeof NetToPointPairsSolver> | PipelineStep<typeof CapacityMeshNodeSolver2_NodeUnderObstacle> | PipelineStep<typeof SingleLayerNodeMergerSolver> | PipelineStep<typeof StrawSolver> | PipelineStep<typeof CapacityMeshEdgeSolver2_NodeTreeOptimization> | PipelineStep<typeof CapacityPathingGreedySolver> | PipelineStep<typeof CapacityPathingMultiSectionSolver> | PipelineStep<typeof CapacityEdgeToPortSegmentSolver> | PipelineStep<typeof CapacitySegmentToPointSolver> | PipelineStep<typeof UnravelMultiSectionSolver> | PipelineStep<typeof HighDensitySolver> | PipelineStep<typeof MultipleHighDensityRouteStitchSolver> | PipelineStep<typeof UselessViaRemovalSolver> | PipelineStep<typeof MultiSimplifiedPathSolver>)[];
|
|
1792
1819
|
constructor(srj: SimpleRouteJson, opts?: CapacityMeshSolverOptions);
|
|
1793
1820
|
currentPipelineStepIndex: number;
|