Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ export class AutoroutingPipelineSolver3_HgPortPointPathing extends BaseSolver {
connMap: cms.connMap,
viaDiameter: cms.viaDiameter,
traceWidth: cms.minTraceWidth,
effort: cms.effort,
},
]),
definePipelineStep(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ export class MultiHeadPolyLineIntraNodeSolver3 extends MultiHeadPolyLineIntraNod
// Pass relevant hyperparameters if needed, e.g., shuffle seed
hyperParameters: {
SHUFFLE_SEED: shuffleSeed,
MAX_VIA_COUNT: Math.max(
5,
this.minViaCount * 3,
Math.ceil(this.uniqueConnections * 2),
),
},
viaDiameter: this.viaDiameter,
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export interface Segment {

export interface ViaPossibilities2HyperParameters {
SHUFFLE_SEED?: number
MAX_VIA_COUNT?: number
} /**
This solver uses an intersection-based approach. Here's how it works:
0. Prepare placeholderPaths
Expand Down Expand Up @@ -88,7 +89,7 @@ export class ViaPossibilitiesSolver2 extends BaseSolver {
this.MAX_ITERATIONS = 100e3
this.colorMap =
colorMap ?? generateColorMapFromNodeWithPortPoints(nodeWithPortPoints)
this.maxViaCount = 5
this.maxViaCount = hyperParameters?.MAX_VIA_COUNT ?? 5
this.bounds = getBoundsFromNodeWithPortPoints(nodeWithPortPoints)
this.nodeWidth = this.bounds.maxX - this.bounds.minX
this.portPairMap = getPortPairMap(nodeWithPortPoints)
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"vercel-build": "cosmos-export",
"repomix:lib": "repomix --ignore 'testing/**,**/TwoRouteHighDensitySolver/**,**/RouteStitchingSolver/**,solvers/CapacitySegmentPointOptimizer/CapacitySegmentPointOptimizer.ts' lib",
"bug-report": "bun run scripts/download-bug-report.ts",
"bug-report-with-test": "bun run scripts/create-bug-report-test.ts"
"bug-report-with-test": "bun run scripts/create-bug-report-test.ts",
"analyze:pipeline3hg": "bun run scripts/analyze-pipeline3hg-failure.ts"
},
"devDependencies": {
"@biomejs/biome": "^1.9.4",
Expand Down
83 changes: 83 additions & 0 deletions scripts/analyze-pipeline3hg-failure.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#!/usr/bin/env bun

import * as dataset from "@tscircuit/autorouting-dataset-01"
import { AutoroutingPipelineSolver3_HgPortPointPathing } from "../lib/autorouter-pipelines/AutoroutingPipeline2_PortPointPathing/AutoroutingPipelineSolver3_HgPortPointPathing"
import { getIntraNodeCrossingsUsingCircle } from "../lib/utils/getIntraNodeCrossingsUsingCircle"
import { calculateNodeProbabilityOfFailure } from "../lib/solvers/UnravelSolver/calculateCrossingProbabilityOfFailure"

const args = process.argv.slice(2)
const scenarioName = args[0] ?? "circuit100"

const srj = (dataset as Record<string, any>)[scenarioName]
if (!srj) {
console.error(
`Scenario \"${scenarioName}\" not found in @tscircuit/autorouting-dataset-01`,
)
process.exit(1)
}

const solver = new AutoroutingPipelineSolver3_HgPortPointPathing(srj)
solver.solve()

const highDensitySolver = solver.highDensityRouteSolver as any
const failedSolvers = (highDensitySolver?.failedSolvers ?? []) as Array<any>

console.log(`Scenario: ${scenarioName}`)
console.log(
`Pipeline solved=${solver.solved} failed=${solver.failed} phase=${solver.getCurrentPhase()} time=${solver.timeToSolve}ms`,
)

if (failedSolvers.length === 0) {
console.log("No failed nodes detected in HighDensitySolver.")
process.exit(0)
}

const analyzed = failedSolvers.map((failedSolver) => {
const node = failedSolver.nodeWithPortPoints
const crossings = getIntraNodeCrossingsUsingCircle(node)
const pf = calculateNodeProbabilityOfFailure(
node,
crossings.numSameLayerCrossings,
crossings.numEntryExitLayerChanges,
crossings.numTransitionPairCrossings,
)

return {
nodeId: node.capacityMeshNodeId,
numPortPoints: node.portPoints.length,
sameLayerCrossings: crossings.numSameLayerCrossings,
entryExitLayerChanges: crossings.numEntryExitLayerChanges,
transitionPairCrossings: crossings.numTransitionPairCrossings,
estimatedPf: pf,
error: failedSolver.error,
}
})

analyzed.sort((a, b) => b.estimatedPf - a.estimatedPf)

console.log(`Failed nodes: ${analyzed.length}`)
for (const node of analyzed) {
console.log("-")
console.log(` node=${node.nodeId}`)
console.log(` estimatedPf=${node.estimatedPf.toFixed(3)}`)
console.log(` portPoints=${node.numPortPoints}`)
console.log(
` crossings(sameLayer=${node.sameLayerCrossings}, entryExitLayerChanges=${node.entryExitLayerChanges}, transitionPair=${node.transitionPairCrossings})`,
)
console.log(` error=${node.error}`)
}

const worst = analyzed[0]
console.log("\nSuggested plan:")
console.log(
`1) Prioritize node ${worst.nodeId} (highest estimated failure probability ${worst.estimatedPf.toFixed(3)}).`,
)
console.log(
"2) Increase Pipeline3 HG effort (e.g. new AutoroutingPipelineSolver3_HgPortPointPathing(srj, { effort: 2 })) to raise high-density solver iteration budgets.",
)
console.log(
"3) If failures mention via-limit exhaustion, increase the max-via allowance in the MultiHead solver/ViaPossibilities path for high-Pf nodes.",
)
console.log(
"4) Re-run this script and confirm reduced failed-node count and lower worst-node estimatedPf.",
)
Loading