@tscircuit/capacity-autorouter 0.0.249 → 0.0.251
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 +147 -27
- package/dist/index.js +21 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,8 @@ import * as graphics_debug from 'graphics-debug';
|
|
|
2
2
|
import { GraphicsObject, Rect, Circle, Line, Point as Point$5 } from 'graphics-debug';
|
|
3
3
|
import { ConnectivityMap } from 'circuit-json-to-connectivity-map';
|
|
4
4
|
import { RectDiffPipeline } from '@tscircuit/rectdiff';
|
|
5
|
-
import { JumperGraphSolver, JRegion } from '@tscircuit/hypergraph';
|
|
5
|
+
import { JumperGraphSolver, JRegion, JPort } from '@tscircuit/hypergraph';
|
|
6
|
+
import { CurvyTraceSolver } from '@tscircuit/curvy-trace-solver';
|
|
6
7
|
import { ConnectivityMap as ConnectivityMap$1 } from 'connectivity-map';
|
|
7
8
|
import { Polygon } from '@tscircuit/math-utils';
|
|
8
9
|
|
|
@@ -3039,10 +3040,11 @@ declare class SimpleHighDensitySolver extends BaseSolver {
|
|
|
3039
3040
|
visualize(): GraphicsObject;
|
|
3040
3041
|
}
|
|
3041
3042
|
|
|
3042
|
-
type HyperGraphPatternType = "single_1206x4" | "1x2_1206x4" | "2x2_1206x4" | "3x1_1206x4" | "3x2_1206x4" | "3x3_1206x4" | "4x4_1206x4" | "6x4_1206x4" | "8x4_1206x4";
|
|
3043
3043
|
interface JumperPrepatternSolver2HyperParameters {
|
|
3044
|
-
/**
|
|
3045
|
-
|
|
3044
|
+
/** Number of columns in the jumper grid */
|
|
3045
|
+
COLS?: number;
|
|
3046
|
+
/** Number of rows in the jumper grid */
|
|
3047
|
+
ROWS?: number;
|
|
3046
3048
|
/** Orientation of jumpers - "horizontal" or "vertical" */
|
|
3047
3049
|
ORIENTATION?: "horizontal" | "vertical";
|
|
3048
3050
|
}
|
|
@@ -3088,26 +3090,60 @@ declare class JumperPrepatternSolver2_HyperGraph extends BaseSolver {
|
|
|
3088
3090
|
}>;
|
|
3089
3091
|
solvedRoutes: HighDensityIntraNodeRouteWithJumpers[];
|
|
3090
3092
|
jumpers: Jumper$1[];
|
|
3093
|
+
phase: "jumperGraph" | "curvyTrace" | "done";
|
|
3094
|
+
curvySolvers: Array<{
|
|
3095
|
+
solver: CurvyTraceSolver;
|
|
3096
|
+
regionId: string;
|
|
3097
|
+
traversals: Array<{
|
|
3098
|
+
routeIndex: number;
|
|
3099
|
+
connectionName: string;
|
|
3100
|
+
rootConnectionName?: string;
|
|
3101
|
+
}>;
|
|
3102
|
+
}>;
|
|
3103
|
+
currentCurvySolverIndex: number;
|
|
3104
|
+
routeInfos: Array<{
|
|
3105
|
+
connectionId: string;
|
|
3106
|
+
rootConnectionName?: string;
|
|
3107
|
+
jumpers: Jumper[];
|
|
3108
|
+
traversals: Array<{
|
|
3109
|
+
regionId: string;
|
|
3110
|
+
region: JRegion;
|
|
3111
|
+
entryPort: JPort;
|
|
3112
|
+
exitPort: JPort | null;
|
|
3113
|
+
}>;
|
|
3114
|
+
}>;
|
|
3115
|
+
regionCurvedPaths: Map<string, Map<string, Array<{
|
|
3116
|
+
path: Array<{
|
|
3117
|
+
x: number;
|
|
3118
|
+
y: number;
|
|
3119
|
+
}>;
|
|
3120
|
+
start: {
|
|
3121
|
+
x: number;
|
|
3122
|
+
y: number;
|
|
3123
|
+
};
|
|
3124
|
+
end: {
|
|
3125
|
+
x: number;
|
|
3126
|
+
y: number;
|
|
3127
|
+
};
|
|
3128
|
+
}>>>;
|
|
3091
3129
|
constructor(params: JumperPrepatternSolver2Params);
|
|
3092
3130
|
getConstructorParams(): JumperPrepatternSolver2Params;
|
|
3093
3131
|
private _buildColorMap;
|
|
3094
3132
|
private _getPatternConfig;
|
|
3095
3133
|
private _initializeGraph;
|
|
3096
3134
|
_step(): void;
|
|
3097
|
-
private
|
|
3135
|
+
private _stepJumperGraph;
|
|
3136
|
+
private _stepCurvyTrace;
|
|
3098
3137
|
/**
|
|
3099
|
-
*
|
|
3100
|
-
*
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
*
|
|
3105
|
-
*
|
|
3106
|
-
* This handles both:
|
|
3107
|
-
* 1. Segments from different connections that overlap
|
|
3108
|
-
* 2. Segments from the SAME connection that overlap (when a route doubles back)
|
|
3138
|
+
* Initialize CurvyTraceSolvers for each routing region.
|
|
3139
|
+
* Called after JumperGraphSolver completes to set up the curvy trace phase.
|
|
3140
|
+
*/
|
|
3141
|
+
private _initializeCurvyTraceSolvers;
|
|
3142
|
+
/**
|
|
3143
|
+
* Finalize results after all CurvyTraceSolvers have completed.
|
|
3144
|
+
* Assembles final routes using curved paths where available.
|
|
3109
3145
|
*/
|
|
3110
|
-
private
|
|
3146
|
+
private _finalizeCurvyTraceResults;
|
|
3111
3147
|
getOutput(): HighDensityIntraNodeRouteWithJumpers[];
|
|
3112
3148
|
/**
|
|
3113
3149
|
* Returns all jumpers from the baseGraph as SRJ Jumper objects.
|
|
@@ -3127,7 +3163,8 @@ interface HyperJumperPrepatternSolver2Params {
|
|
|
3127
3163
|
hyperParameters?: JumperPrepatternSolver2HyperParameters;
|
|
3128
3164
|
}
|
|
3129
3165
|
type VariantHyperParameters = {
|
|
3130
|
-
|
|
3166
|
+
COLS: number;
|
|
3167
|
+
ROWS: number;
|
|
3131
3168
|
ORIENTATION: "horizontal" | "vertical";
|
|
3132
3169
|
};
|
|
3133
3170
|
/**
|
|
@@ -3154,7 +3191,12 @@ declare class HyperJumperPrepatternSolver2 extends HyperParameterSupervisorSolve
|
|
|
3154
3191
|
getHyperParameterDefs(): ({
|
|
3155
3192
|
name: string;
|
|
3156
3193
|
possibleValues: {
|
|
3157
|
-
|
|
3194
|
+
COLS: number;
|
|
3195
|
+
}[];
|
|
3196
|
+
} | {
|
|
3197
|
+
name: string;
|
|
3198
|
+
possibleValues: {
|
|
3199
|
+
ROWS: number;
|
|
3158
3200
|
}[];
|
|
3159
3201
|
} | {
|
|
3160
3202
|
name: string;
|
|
@@ -3172,6 +3214,44 @@ declare class HyperJumperPrepatternSolver2 extends HyperParameterSupervisorSolve
|
|
|
3172
3214
|
visualize(): GraphicsObject;
|
|
3173
3215
|
}
|
|
3174
3216
|
|
|
3217
|
+
interface AdjacentObstacle {
|
|
3218
|
+
minX: number;
|
|
3219
|
+
minY: number;
|
|
3220
|
+
maxX: number;
|
|
3221
|
+
maxY: number;
|
|
3222
|
+
networkId?: string;
|
|
3223
|
+
}
|
|
3224
|
+
interface CurvyIntraNodeSolverParams {
|
|
3225
|
+
nodeWithPortPoints: NodeWithPortPoints;
|
|
3226
|
+
colorMap?: Record<string, string>;
|
|
3227
|
+
traceWidth?: number;
|
|
3228
|
+
viaDiameter?: number;
|
|
3229
|
+
/** Obstacles from adjacent/solved nodes that might affect routing */
|
|
3230
|
+
adjacentObstacles?: AdjacentObstacle[];
|
|
3231
|
+
}
|
|
3232
|
+
/**
|
|
3233
|
+
* A solver that uses CurvyTraceSolver to create curved traces within a node.
|
|
3234
|
+
* It converts port points to waypoint pairs and generates smooth curved traces
|
|
3235
|
+
* that maximize distance between traces and obstacles.
|
|
3236
|
+
*/
|
|
3237
|
+
declare class CurvyIntraNodeSolver extends BaseSolver {
|
|
3238
|
+
nodeWithPortPoints: NodeWithPortPoints;
|
|
3239
|
+
colorMap: Record<string, string>;
|
|
3240
|
+
traceWidth: number;
|
|
3241
|
+
viaDiameter: number;
|
|
3242
|
+
adjacentObstacles: AdjacentObstacle[];
|
|
3243
|
+
routes: HighDensityIntraNodeRoute$1[];
|
|
3244
|
+
curvyTraceSolver?: CurvyTraceSolver;
|
|
3245
|
+
phase: "initializing" | "solving" | "done";
|
|
3246
|
+
constructor(params: CurvyIntraNodeSolverParams);
|
|
3247
|
+
_step(): void;
|
|
3248
|
+
_initializeCurvySolver(): void;
|
|
3249
|
+
_stepCurvySolver(): void;
|
|
3250
|
+
_convertOutputTraces(): void;
|
|
3251
|
+
getConstructorParams(): CurvyIntraNodeSolverParams;
|
|
3252
|
+
visualize(): GraphicsObject;
|
|
3253
|
+
}
|
|
3254
|
+
|
|
3175
3255
|
interface NodeAnalysis {
|
|
3176
3256
|
node: NodeWithPortPoints;
|
|
3177
3257
|
hasCrossings: boolean;
|
|
@@ -3179,10 +3259,11 @@ interface NodeAnalysis {
|
|
|
3179
3259
|
}
|
|
3180
3260
|
/**
|
|
3181
3261
|
* HighDensitySolver intelligently selects the appropriate solver for each node:
|
|
3182
|
-
* -
|
|
3262
|
+
* - CurvyIntraNodeSolver for nodes without crossings (uses curvy trace solver)
|
|
3183
3263
|
* - IntraNodeSolverWithJumpers for single-layer nodes with crossings (uses 0603 jumpers)
|
|
3184
3264
|
*
|
|
3185
|
-
* This solver processes nodes
|
|
3265
|
+
* This solver processes nodes one at a time, passing adjacent obstacles from
|
|
3266
|
+
* already-solved routes to maximize trace spacing.
|
|
3186
3267
|
*/
|
|
3187
3268
|
declare class JumperHighDensitySolver extends BaseSolver {
|
|
3188
3269
|
allNodes: NodeWithPortPoints[];
|
|
@@ -3193,27 +3274,59 @@ declare class JumperHighDensitySolver extends BaseSolver {
|
|
|
3193
3274
|
viaDiameter: number;
|
|
3194
3275
|
connMap?: ConnectivityMap;
|
|
3195
3276
|
hyperParameters?: Partial<HighDensityHyperParameters>;
|
|
3277
|
+
capacityMeshNodes: CapacityMeshNode[];
|
|
3278
|
+
capacityMeshEdges: CapacityMeshEdge[];
|
|
3279
|
+
capacityMeshNodeMap: Map<string, CapacityMeshNode>;
|
|
3280
|
+
nodeAdjacencyMap: Map<string, Set<string>>;
|
|
3196
3281
|
nodesWithoutCrossings: NodeWithPortPoints[];
|
|
3197
3282
|
nodesWithCrossings: NodeWithPortPoints[];
|
|
3198
|
-
|
|
3283
|
+
curvyIntraNodeSolvers: CurvyIntraNodeSolver[];
|
|
3284
|
+
currentCurvySolverIndex: number;
|
|
3199
3285
|
jumperSolvers: HyperJumperPrepatternSolver2[];
|
|
3200
3286
|
currentJumperSolverIndex: number;
|
|
3201
|
-
phase: "analyzing" | "
|
|
3287
|
+
phase: "analyzing" | "curvy" | "jumpers" | "done";
|
|
3202
3288
|
jumpers: Jumper$1[];
|
|
3203
|
-
constructor({ nodePortPoints, colorMap, traceWidth, viaDiameter, connMap, hyperParameters, }: {
|
|
3289
|
+
constructor({ nodePortPoints, colorMap, traceWidth, viaDiameter, connMap, hyperParameters, capacityMeshNodes, capacityMeshEdges, }: {
|
|
3204
3290
|
nodePortPoints: NodeWithPortPoints[];
|
|
3205
3291
|
colorMap?: Record<string, string>;
|
|
3206
3292
|
traceWidth?: number;
|
|
3207
3293
|
viaDiameter?: number;
|
|
3208
3294
|
connMap?: ConnectivityMap;
|
|
3209
3295
|
hyperParameters?: Partial<HighDensityHyperParameters>;
|
|
3296
|
+
capacityMeshNodes?: CapacityMeshNode[];
|
|
3297
|
+
capacityMeshEdges?: CapacityMeshEdge[];
|
|
3210
3298
|
});
|
|
3299
|
+
/**
|
|
3300
|
+
* Build adjacency map from edges for quick lookup of adjacent nodes
|
|
3301
|
+
*/
|
|
3302
|
+
_buildNodeAdjacencyMap(): Map<string, Set<string>>;
|
|
3211
3303
|
/**
|
|
3212
3304
|
* Analyze all nodes to determine which solver to use for each
|
|
3213
3305
|
*/
|
|
3214
3306
|
_analyzeNodes(): void;
|
|
3215
3307
|
_step(): void;
|
|
3216
|
-
|
|
3308
|
+
/**
|
|
3309
|
+
* Compute obstacles from adjacent nodes.
|
|
3310
|
+
* Uses the edge solver's adjacency information and only considers nodes
|
|
3311
|
+
* that contain obstacles or targets.
|
|
3312
|
+
*
|
|
3313
|
+
* Rules:
|
|
3314
|
+
* - Only adjacent nodes (from edges) are considered
|
|
3315
|
+
* - Only nodes with _containsObstacle or _containsTarget are obstacles
|
|
3316
|
+
* - If node contains obstacle but no target: no networkId
|
|
3317
|
+
* - If node contains target: networkId = _targetConnectionName (or from port points)
|
|
3318
|
+
*/
|
|
3319
|
+
_getAdjacentObstacles(node: NodeWithPortPoints): AdjacentObstacle[];
|
|
3320
|
+
/**
|
|
3321
|
+
* Initialize CurvyIntraNodeSolver for each node without crossings.
|
|
3322
|
+
* Each solver is created with adjacent obstacles from already-solved routes.
|
|
3323
|
+
*/
|
|
3324
|
+
_initializeCurvySolvers(): void;
|
|
3325
|
+
/**
|
|
3326
|
+
* Step through curvy solvers one at a time.
|
|
3327
|
+
* After each solver completes, its routes become obstacles for subsequent nodes.
|
|
3328
|
+
*/
|
|
3329
|
+
_stepCurvySolvers(): void;
|
|
3217
3330
|
_initializeJumperSolvers(): void;
|
|
3218
3331
|
_stepJumperSolvers(): void;
|
|
3219
3332
|
computeProgress(): number;
|
|
@@ -3224,6 +3337,8 @@ declare class JumperHighDensitySolver extends BaseSolver {
|
|
|
3224
3337
|
viaDiameter: number;
|
|
3225
3338
|
connMap: ConnectivityMap | undefined;
|
|
3226
3339
|
hyperParameters: Partial<HighDensityHyperParameters> | undefined;
|
|
3340
|
+
capacityMeshNodes: CapacityMeshNode[];
|
|
3341
|
+
capacityMeshEdges: CapacityMeshEdge[];
|
|
3227
3342
|
};
|
|
3228
3343
|
/**
|
|
3229
3344
|
* Returns ALL jumpers collected from the jumper solvers.
|
|
@@ -3790,6 +3905,11 @@ declare class MultipleHighDensityRouteStitchSolver2 extends BaseSolver {
|
|
|
3790
3905
|
* Order routes based on the node traversal path.
|
|
3791
3906
|
* Each node in nodeOrder may have one or more routes.
|
|
3792
3907
|
* Returns routes in the order they should be stitched.
|
|
3908
|
+
*
|
|
3909
|
+
* Uses a two-phase approach:
|
|
3910
|
+
* 1. Find the route closest to start, build chain forward
|
|
3911
|
+
* 2. From the connection point of first route, build chain backward
|
|
3912
|
+
* to catch any routes that come before
|
|
3793
3913
|
*/
|
|
3794
3914
|
private orderRoutesByNodePath;
|
|
3795
3915
|
/**
|
|
@@ -3815,6 +3935,7 @@ declare class AssignableAutoroutingPipeline3 extends BaseSolver {
|
|
|
3815
3935
|
srj: SimpleRouteJson;
|
|
3816
3936
|
opts: CapacityMeshSolverOptions$1;
|
|
3817
3937
|
netToPointPairsSolver?: NetToPointPairsSolver;
|
|
3938
|
+
traceKeepoutSolver?: TraceKeepoutSolver;
|
|
3818
3939
|
nodeSolver?: RectDiffPipeline;
|
|
3819
3940
|
nodeTargetMerger?: CapacityNodeTargetMerger;
|
|
3820
3941
|
edgeSolver?: CapacityMeshEdgeSolver;
|
|
@@ -3830,7 +3951,6 @@ declare class AssignableAutoroutingPipeline3 extends BaseSolver {
|
|
|
3830
3951
|
strawSolver?: StrawSolver;
|
|
3831
3952
|
deadEndSolver?: DeadEndSolver;
|
|
3832
3953
|
traceSimplificationSolver?: TraceSimplificationSolver;
|
|
3833
|
-
traceKeepoutSolver?: TraceKeepoutSolver;
|
|
3834
3954
|
traceWidthSolver?: TraceWidthSolver;
|
|
3835
3955
|
availableSegmentPointSolver?: AvailableSegmentPointSolver;
|
|
3836
3956
|
portPointPathingSolver?: PortPointPathingSolver;
|
|
@@ -3847,7 +3967,7 @@ declare class AssignableAutoroutingPipeline3 extends BaseSolver {
|
|
|
3847
3967
|
capacityNodes: CapacityMeshNode[] | null;
|
|
3848
3968
|
capacityEdges: CapacityMeshEdge[] | null;
|
|
3849
3969
|
cacheProvider: CacheProvider | null;
|
|
3850
|
-
pipelineDef: (PipelineStep$1<typeof NetToPointPairsSolver> | PipelineStep$1<typeof RectDiffPipeline> | PipelineStep$1<typeof RelateNodesToOffBoardConnectionsSolver> | PipelineStep$1<typeof CapacityMeshEdgeSolver2_NodeTreeOptimization> | PipelineStep$1<typeof AvailableSegmentPointSolver> | PipelineStep$1<typeof HyperPortPointPathingSolver> | PipelineStep$1<typeof
|
|
3970
|
+
pipelineDef: (PipelineStep$1<typeof NetToPointPairsSolver> | PipelineStep$1<typeof RectDiffPipeline> | PipelineStep$1<typeof RelateNodesToOffBoardConnectionsSolver> | PipelineStep$1<typeof CapacityMeshEdgeSolver2_NodeTreeOptimization> | PipelineStep$1<typeof AvailableSegmentPointSolver> | PipelineStep$1<typeof HyperPortPointPathingSolver> | PipelineStep$1<typeof JumperHighDensitySolver> | PipelineStep$1<typeof MultipleHighDensityRouteStitchSolver2>)[];
|
|
3851
3971
|
constructor(srj: SimpleRouteJson, opts?: CapacityMeshSolverOptions$1);
|
|
3852
3972
|
getConstructorParams(): readonly [SimpleRouteJson, CapacityMeshSolverOptions$1];
|
|
3853
3973
|
currentPipelineStepIndex: number;
|
|
@@ -5050,4 +5170,4 @@ declare class IntraNodeSolverWithJumpers extends BaseSolver {
|
|
|
5050
5170
|
visualize(): GraphicsObject;
|
|
5051
5171
|
}
|
|
5052
5172
|
|
|
5053
|
-
export { AssignableAutoroutingPipeline1Solver, AssignableAutoroutingPipeline2, AssignableAutoroutingPipeline3, AutoroutingPipeline1_OriginalUnravel, AutoroutingPipelineSolver2_PortPointPathing as AutoroutingPipelineSolver, type AutoroutingPipelineSolverOptions, type CachableSolver, type CacheProvider, CapacityMeshSolver, type HighDensityIntraNodeRouteWithJumpers, JumperHighDensitySolver as HighDensitySolver, InMemoryCache, IntraNodeSolverWithJumpers, type Jumper, LocalStorageCache, SingleHighDensityRouteWithJumpersSolver, calculateOptimalCapacityDepth, convertSrjToGraphicsObject, getGlobalInMemoryCache, getGlobalLocalStorageCache, getTunedTotalCapacity1, setupGlobalCaches };
|
|
5173
|
+
export { AssignableAutoroutingPipeline1Solver, AssignableAutoroutingPipeline2, AssignableAutoroutingPipeline3, AutoroutingPipeline1_OriginalUnravel, AutoroutingPipelineSolver2_PortPointPathing as AutoroutingPipelineSolver, type AutoroutingPipelineSolverOptions, type CachableSolver, type CacheProvider, CapacityMeshSolver, CurvyIntraNodeSolver, type HighDensityIntraNodeRouteWithJumpers, JumperHighDensitySolver as HighDensitySolver, InMemoryCache, IntraNodeSolverWithJumpers, type Jumper, LocalStorageCache, SingleHighDensityRouteWithJumpersSolver, calculateOptimalCapacityDepth, convertSrjToGraphicsObject, getGlobalInMemoryCache, getGlobalLocalStorageCache, getTunedTotalCapacity1, setupGlobalCaches };
|