@tscircuit/capacity-autorouter 0.0.129 → 0.0.130
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 +75 -39
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -642,6 +642,78 @@ declare class IntraNodeRouteSolver extends BaseSolver {
|
|
|
642
642
|
visualize(): GraphicsObject;
|
|
643
643
|
}
|
|
644
644
|
|
|
645
|
+
interface CacheProvider {
|
|
646
|
+
isSyncCache: boolean;
|
|
647
|
+
cacheHits: number;
|
|
648
|
+
cacheMisses: number;
|
|
649
|
+
cacheHitsByPrefix: Record<string, number>;
|
|
650
|
+
cacheMissesByPrefix: Record<string, number>;
|
|
651
|
+
getCachedSolutionSync(cacheKey: string): any;
|
|
652
|
+
getCachedSolution(cacheKey: string): Promise<any>;
|
|
653
|
+
setCachedSolutionSync(cacheKey: string, cachedSolution: any): void;
|
|
654
|
+
setCachedSolution(cacheKey: string, cachedSolution: any): Promise<void>;
|
|
655
|
+
getAllCacheKeys(): string[];
|
|
656
|
+
clearCache(): void;
|
|
657
|
+
}
|
|
658
|
+
interface CachableSolver<CacheToSolveSpaceTransform = any, CachedSolution = any> {
|
|
659
|
+
cacheHit: boolean;
|
|
660
|
+
hasAttemptedToUseCache: boolean;
|
|
661
|
+
cacheProvider: CacheProvider | null;
|
|
662
|
+
cacheKey?: string;
|
|
663
|
+
cacheToSolveSpaceTransform?: CacheToSolveSpaceTransform;
|
|
664
|
+
/**
|
|
665
|
+
* Processes solver inputs and constructs a cacheKey and a cacheToSolveSpaceTransform
|
|
666
|
+
* which gives the necessary information to convert a cached solution into a valid
|
|
667
|
+
* solution for this solver. For example, the cacheKey may be translation-invariant, so
|
|
668
|
+
* any cachedSolution would not be translated properly for this solver. The cacheToSolveSpaceTransform
|
|
669
|
+
* tells you how to convert from the cache space (translation-invarant) to the correct
|
|
670
|
+
* space for this solver. It can also contain information about how cache ids map to
|
|
671
|
+
* ids for the solver
|
|
672
|
+
**/
|
|
673
|
+
computeCacheKeyAndTransform(): {
|
|
674
|
+
cacheKey: string;
|
|
675
|
+
cacheToSolveSpaceTransform: CacheToSolveSpaceTransform;
|
|
676
|
+
};
|
|
677
|
+
applyCachedSolution(cachedSolution: CachedSolution): void;
|
|
678
|
+
attemptToUseCacheSync(): boolean;
|
|
679
|
+
saveToCacheSync(): void;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
type CachedSolvedIntraNodeRouteSolver = {
|
|
683
|
+
success: true;
|
|
684
|
+
solvedRoutes: HighDensityIntraNodeRoute$1[];
|
|
685
|
+
} | {
|
|
686
|
+
success: false;
|
|
687
|
+
error?: string;
|
|
688
|
+
};
|
|
689
|
+
type CacheToIntraNodeSolverTransform = Record<string, never>;
|
|
690
|
+
declare class CachedIntraNodeRouteSolver extends IntraNodeRouteSolver implements CachableSolver<CacheToIntraNodeSolverTransform, CachedSolvedIntraNodeRouteSolver> {
|
|
691
|
+
cacheProvider: CacheProvider | null;
|
|
692
|
+
cacheHit: boolean;
|
|
693
|
+
hasAttemptedToUseCache: boolean;
|
|
694
|
+
cacheKey?: string | undefined;
|
|
695
|
+
cacheToSolveSpaceTransform?: CacheToIntraNodeSolverTransform | undefined;
|
|
696
|
+
initialUnsolvedConnections: {
|
|
697
|
+
connectionName: string;
|
|
698
|
+
points: {
|
|
699
|
+
x: number;
|
|
700
|
+
y: number;
|
|
701
|
+
z: number;
|
|
702
|
+
}[];
|
|
703
|
+
}[];
|
|
704
|
+
constructor(params: ConstructorParameters<typeof IntraNodeRouteSolver>[0] & {
|
|
705
|
+
cacheProvider?: CacheProvider | null;
|
|
706
|
+
});
|
|
707
|
+
_step(): void;
|
|
708
|
+
computeCacheKeyAndTransform(): {
|
|
709
|
+
cacheKey: string;
|
|
710
|
+
cacheToSolveSpaceTransform: CacheToIntraNodeSolverTransform;
|
|
711
|
+
};
|
|
712
|
+
applyCachedSolution(cachedSolution: CachedSolvedIntraNodeRouteSolver): void;
|
|
713
|
+
attemptToUseCacheSync(): boolean;
|
|
714
|
+
saveToCacheSync(): void;
|
|
715
|
+
}
|
|
716
|
+
|
|
645
717
|
type SupervisedSolver<T extends BaseSolver> = {
|
|
646
718
|
hyperParameters: any;
|
|
647
719
|
solver: T;
|
|
@@ -752,11 +824,11 @@ declare class TwoCrossingRoutesHighDensitySolver extends BaseSolver {
|
|
|
752
824
|
}
|
|
753
825
|
|
|
754
826
|
declare class HyperSingleIntraNodeSolver extends HyperParameterSupervisorSolver<IntraNodeRouteSolver | TwoCrossingRoutesHighDensitySolver> {
|
|
755
|
-
constructorParams: ConstructorParameters<typeof
|
|
827
|
+
constructorParams: ConstructorParameters<typeof CachedIntraNodeRouteSolver>[0];
|
|
756
828
|
solvedRoutes: HighDensityIntraNodeRoute$1[];
|
|
757
829
|
nodeWithPortPoints: NodeWithPortPoints;
|
|
758
830
|
connMap?: ConnectivityMap;
|
|
759
|
-
constructor(opts: ConstructorParameters<typeof
|
|
831
|
+
constructor(opts: ConstructorParameters<typeof CachedIntraNodeRouteSolver>[0]);
|
|
760
832
|
getCombinationDefs(): string[][];
|
|
761
833
|
getHyperParameterDefs(): ({
|
|
762
834
|
name: string;
|
|
@@ -844,6 +916,7 @@ declare class HighDensitySolver extends BaseSolver {
|
|
|
844
916
|
* of it.
|
|
845
917
|
*/
|
|
846
918
|
_step(): void;
|
|
919
|
+
private updateCacheStats;
|
|
847
920
|
visualize(): GraphicsObject;
|
|
848
921
|
}
|
|
849
922
|
|
|
@@ -1307,43 +1380,6 @@ declare class UnravelSectionSolver extends BaseSolver {
|
|
|
1307
1380
|
visualize(): GraphicsObject;
|
|
1308
1381
|
}
|
|
1309
1382
|
|
|
1310
|
-
interface CacheProvider {
|
|
1311
|
-
isSyncCache: boolean;
|
|
1312
|
-
cacheHits: number;
|
|
1313
|
-
cacheMisses: number;
|
|
1314
|
-
cacheHitsByPrefix: Record<string, number>;
|
|
1315
|
-
cacheMissesByPrefix: Record<string, number>;
|
|
1316
|
-
getCachedSolutionSync(cacheKey: string): any;
|
|
1317
|
-
getCachedSolution(cacheKey: string): Promise<any>;
|
|
1318
|
-
setCachedSolutionSync(cacheKey: string, cachedSolution: any): void;
|
|
1319
|
-
setCachedSolution(cacheKey: string, cachedSolution: any): Promise<void>;
|
|
1320
|
-
getAllCacheKeys(): string[];
|
|
1321
|
-
clearCache(): void;
|
|
1322
|
-
}
|
|
1323
|
-
interface CachableSolver<CacheToSolveSpaceTransform = any, CachedSolution = any> {
|
|
1324
|
-
cacheHit: boolean;
|
|
1325
|
-
hasAttemptedToUseCache: boolean;
|
|
1326
|
-
cacheProvider: CacheProvider | null;
|
|
1327
|
-
cacheKey?: string;
|
|
1328
|
-
cacheToSolveSpaceTransform?: CacheToSolveSpaceTransform;
|
|
1329
|
-
/**
|
|
1330
|
-
* Processes solver inputs and constructs a cacheKey and a cacheToSolveSpaceTransform
|
|
1331
|
-
* which gives the necessary information to convert a cached solution into a valid
|
|
1332
|
-
* solution for this solver. For example, the cacheKey may be translation-invariant, so
|
|
1333
|
-
* any cachedSolution would not be translated properly for this solver. The cacheToSolveSpaceTransform
|
|
1334
|
-
* tells you how to convert from the cache space (translation-invarant) to the correct
|
|
1335
|
-
* space for this solver. It can also contain information about how cache ids map to
|
|
1336
|
-
* ids for the solver
|
|
1337
|
-
**/
|
|
1338
|
-
computeCacheKeyAndTransform(): {
|
|
1339
|
-
cacheKey: string;
|
|
1340
|
-
cacheToSolveSpaceTransform: CacheToSolveSpaceTransform;
|
|
1341
|
-
};
|
|
1342
|
-
applyCachedSolution(cachedSolution: CachedSolution): void;
|
|
1343
|
-
attemptToUseCacheSync(): boolean;
|
|
1344
|
-
saveToCacheSync(): void;
|
|
1345
|
-
}
|
|
1346
|
-
|
|
1347
1383
|
declare class UnravelMultiSectionSolver extends BaseSolver {
|
|
1348
1384
|
nodeMap: Map<CapacityMeshNodeId, CapacityMeshNode>;
|
|
1349
1385
|
dedupedSegmentMap: Map<SegmentId, SegmentWithAssignedPoints>;
|