@tscircuit/capacity-autorouter 0.0.55 → 0.0.56

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
@@ -101,6 +101,7 @@ declare class BaseSolver {
101
101
  activeSubSolver?: BaseSolver | null;
102
102
  failedSubSolvers?: BaseSolver[];
103
103
  timeToSolve?: number;
104
+ stats: Record<string, number>;
104
105
  /** DO NOT OVERRIDE! Override _step() instead */
105
106
  step(): void;
106
107
  _step(): void;
@@ -616,6 +617,7 @@ declare class HyperParameterSupervisorSolver<T extends BaseSolver> extends BaseS
616
617
  computeH(solver: T): number;
617
618
  computeF(g: number, h: number): number;
618
619
  getSupervisedSolverWithBestFitness(): SupervisedSolver<T> | null;
620
+ getFailureMessage(): string;
619
621
  _step(): void;
620
622
  onSolve(solver: SupervisedSolver<T>): void;
621
623
  visualize(): GraphicsObject;
@@ -1387,9 +1389,10 @@ interface CapacityPathingSingleSectionPathingSolverParams {
1387
1389
  endNodeId: CapacityMeshNodeId;
1388
1390
  }>;
1389
1391
  colorMap?: Record<string, string>;
1392
+ centerNodeId: string;
1390
1393
  hyperParameters?: CpssPathingSolverHyperParameters;
1391
1394
  }
1392
- declare class CapacityPathingSingleSectionPathingSolver extends BaseSolver {
1395
+ declare class CapacityPathingSingleSectionSolver extends BaseSolver {
1393
1396
  GREEDY_MULTIPLIER: number;
1394
1397
  sectionNodes: CapacityMeshNode[];
1395
1398
  sectionEdges: CapacityMeshEdge[];
@@ -1403,6 +1406,7 @@ declare class CapacityPathingSingleSectionPathingSolver extends BaseSolver {
1403
1406
  nodeEdgeMap: Map<CapacityMeshNodeId, CapacityMeshEdge[]>;
1404
1407
  colorMap: Record<string, string>;
1405
1408
  usedNodeCapacityMap: Map<CapacityMeshNodeId, number>;
1409
+ centerNodeId: string;
1406
1410
  MAX_CANDIDATES_IN_MEMORY: number;
1407
1411
  currentConnectionIndex: number;
1408
1412
  candidates?: Array<Candidate> | null;
@@ -1428,50 +1432,50 @@ declare class CapacityPathingSingleSectionPathingSolver extends BaseSolver {
1428
1432
  doesNodeHaveCapacityForTrace(node: CapacityMeshNode, prevNode: CapacityMeshNode | null): boolean;
1429
1433
  reduceCapacityAlongPath(path: CapacityMeshNode[]): void;
1430
1434
  _step(): void;
1435
+ computeProgress(): number;
1431
1436
  private _setupAStar;
1432
1437
  private _handleCandidatesExhausted;
1433
1438
  private _handleGoalReached;
1434
1439
  visualize(): GraphicsObject;
1435
1440
  }
1441
+ declare const CapacityPathingSingleSectionPathingSolver: typeof CapacityPathingSingleSectionSolver;
1442
+ type CapacityPathingSingleSectionPathingSolver = InstanceType<typeof CapacityPathingSingleSectionSolver>;
1436
1443
 
1437
- interface CapacityPathingSingleSectionSolverInput {
1438
- centerNodeId: CapacityMeshNodeId;
1439
- connectionsWithNodes: Array<ConnectionPathWithNodes>;
1440
- nodes: CapacityMeshNode[];
1441
- edges: CapacityMeshEdge[];
1442
- colorMap: Record<string, string>;
1443
- hyperParameters?: CpssPathingSolverHyperParameters;
1444
- }
1445
- declare class CapacityPathingSingleSectionSolver extends BaseSolver {
1446
- centerNodeId: CapacityMeshNodeId;
1447
- connectionsWithNodes: Array<ConnectionPathWithNodes>;
1448
- nodes: CapacityMeshNode[];
1449
- nodeMap: Map<CapacityMeshNodeId, CapacityMeshNode>;
1450
- edges: CapacityMeshEdge[];
1451
- nodeEdgeMap: Map<CapacityMeshNodeId, CapacityMeshEdge[]>;
1452
- expansionDegrees: number;
1453
- colorMap: Record<string, string>;
1454
- sectionNodes: CapacityMeshNode[];
1455
- sectionEdges: CapacityMeshEdge[];
1456
- sectionConnectionTerminals: Array<{
1444
+ declare class HyperCapacityPathingSingleSectionSolver extends HyperParameterSupervisorSolver<CapacityPathingSingleSectionPathingSolver> {
1445
+ constructorParams: CapacityPathingSingleSectionPathingSolverParams;
1446
+ winningSolver?: CapacityPathingSingleSectionPathingSolver;
1447
+ constructor(params: ConstructorParameters<typeof CapacityPathingSingleSectionPathingSolver>[0]);
1448
+ computeG(solver: CapacityPathingSingleSectionPathingSolver): number;
1449
+ computeH(solver: CapacityPathingSingleSectionPathingSolver): number;
1450
+ getCombinationDefs(): Array<Array<string>> | null;
1451
+ getFailureMessage(): string;
1452
+ getHyperParameterDefs(): Array<HyperParameterDef>;
1453
+ generateSolver(hyperParameters: any): CapacityPathingSingleSectionPathingSolver;
1454
+ onSolve({ solver, }: SupervisedSolver<CapacityPathingSingleSectionPathingSolver>): void;
1455
+ get centerNodeId(): string;
1456
+ get sectionNodes(): CapacityMeshNode[];
1457
+ get sectionConnectionTerminals(): {
1457
1458
  connectionName: string;
1458
1459
  startNodeId: CapacityMeshNodeId;
1459
1460
  endNodeId: CapacityMeshNodeId;
1460
- }>;
1461
- activeSubSolver?: CapacityPathingSingleSectionPathingSolver | null | undefined;
1462
- constructor(params: CapacityPathingSingleSectionSolverInput);
1463
- private computeSectionNodesTerminalsAndEdges;
1464
- _step(): void;
1465
- getConstructorParams(): readonly [{
1466
- readonly centerNodeId: string;
1467
- readonly connectionsWithNodes: ConnectionPathWithNodes[];
1468
- readonly nodes: CapacityMeshNode[];
1469
- readonly edges: CapacityMeshEdge[];
1470
- readonly expansionDegrees: number;
1471
- }];
1472
- visualize(): GraphicsObject;
1461
+ path?: CapacityMeshNode[];
1462
+ }[] | undefined;
1463
+ }
1464
+
1465
+ interface SectionConnectionTerminal {
1466
+ connectionName: string;
1467
+ startNodeId: CapacityMeshNodeId;
1468
+ endNodeId: CapacityMeshNodeId;
1469
+ path?: CapacityMeshNode[];
1470
+ }
1471
+ interface CapacityPathingSection {
1472
+ centerNodeId: string;
1473
+ sectionConnectionTerminals: SectionConnectionTerminal[];
1474
+ sectionNodes: CapacityMeshNode[];
1475
+ sectionEdges: CapacityMeshEdge[];
1473
1476
  }
1474
1477
 
1478
+ type CapacityMeshEdgeId = string;
1475
1479
  /**
1476
1480
  * This solver solves for capacity paths by first solving with negative
1477
1481
  * capacities allowed, then re-solving problematic sections with a section
@@ -1481,6 +1485,7 @@ declare class CapacityPathingMultiSectionSolver extends BaseSolver {
1481
1485
  simpleRouteJson: SimpleRouteJson;
1482
1486
  nodes: CapacityMeshNode[];
1483
1487
  edges: CapacityMeshEdge[];
1488
+ nodeEdgeMap: Map<CapacityMeshEdgeId, CapacityMeshEdge[]>;
1484
1489
  connectionsWithNodes: Array<ConnectionPathWithNodes>;
1485
1490
  colorMap: Record<string, string>;
1486
1491
  initialSolver: CapacityPathingGreedySolver;
@@ -1490,7 +1495,8 @@ declare class CapacityPathingMultiSectionSolver extends BaseSolver {
1490
1495
  totalNodeCapacityMap: Map<CapacityMeshNodeId, number>;
1491
1496
  nodeCapacityPercentMap: Map<CapacityMeshNodeId, number>;
1492
1497
  nodeOptimizationAttemptCountMap: Map<CapacityMeshNodeId, number>;
1493
- sectionSolver?: CapacityPathingSingleSectionSolver | null;
1498
+ currentSection: CapacityPathingSection | null;
1499
+ sectionSolver?: CapacityPathingSingleSectionSolver | HyperCapacityPathingSingleSectionSolver | null;
1494
1500
  MAX_ATTEMPTS_PER_NODE: number;
1495
1501
  MINIMUM_PROBABILITY_OF_FAILURE_TO_OPTIMIZE: number;
1496
1502
  MAX_EXPANSION_DEGREES: number;