@tscircuit/capacity-autorouter 0.0.58 → 0.0.60
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 +706 -10
- package/dist/index.js.map +1 -1
- package/package.json +11 -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,18 @@ 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
|
+
getAllCacheKeys(): string[];
|
|
1254
|
+
clearCache(): void;
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1234
1257
|
declare class UnravelMultiSectionSolver extends BaseSolver {
|
|
1235
1258
|
nodeMap: Map<CapacityMeshNodeId, CapacityMeshNode>;
|
|
1236
1259
|
dedupedSegmentMap: Map<SegmentId, SegmentWithAssignedPoints>;
|
|
@@ -1252,7 +1275,8 @@ declare class UnravelMultiSectionSolver extends BaseSolver {
|
|
|
1252
1275
|
attemptsToFixNode: Map<CapacityMeshNodeId, number>;
|
|
1253
1276
|
activeSubSolver: UnravelSectionSolver | null;
|
|
1254
1277
|
segmentPointMap: SegmentPointMap;
|
|
1255
|
-
|
|
1278
|
+
cacheProvider: CacheProvider | null;
|
|
1279
|
+
constructor({ assignedSegments, colorMap, nodes, cacheProvider, }: {
|
|
1256
1280
|
assignedSegments: NodePortSegment[];
|
|
1257
1281
|
colorMap?: Record<string, string>;
|
|
1258
1282
|
/**
|
|
@@ -1260,6 +1284,7 @@ declare class UnravelMultiSectionSolver extends BaseSolver {
|
|
|
1260
1284
|
* for the result datatype (the center, width, height of the node)
|
|
1261
1285
|
*/
|
|
1262
1286
|
nodes: CapacityMeshNode[];
|
|
1287
|
+
cacheProvider?: CacheProvider | null;
|
|
1263
1288
|
});
|
|
1264
1289
|
computeInitialPfMap(): Map<string, number>;
|
|
1265
1290
|
computeNodePf(node: CapacityMeshNode): number;
|
|
@@ -1753,6 +1778,7 @@ declare class UselessViaRemovalSolver extends BaseSolver {
|
|
|
1753
1778
|
interface CapacityMeshSolverOptions {
|
|
1754
1779
|
capacityDepth?: number;
|
|
1755
1780
|
targetMinCapacity?: number;
|
|
1781
|
+
cacheProvider?: CacheProvider | null;
|
|
1756
1782
|
}
|
|
1757
1783
|
type PipelineStep<T extends new (...args: any[]) => BaseSolver> = {
|
|
1758
1784
|
solverName: string;
|
|
@@ -1789,6 +1815,7 @@ declare class AutoroutingPipelineSolver extends BaseSolver {
|
|
|
1789
1815
|
connMap: ConnectivityMap;
|
|
1790
1816
|
srjWithPointPairs?: SimpleRouteJson;
|
|
1791
1817
|
capacityNodes: CapacityMeshNode[] | null;
|
|
1818
|
+
cacheProvider: CacheProvider | null;
|
|
1792
1819
|
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>)[];
|
|
1793
1820
|
constructor(srj: SimpleRouteJson, opts?: CapacityMeshSolverOptions);
|
|
1794
1821
|
currentPipelineStepIndex: number;
|