Skip to content
Open
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
15 changes: 14 additions & 1 deletion lib/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1919,11 +1919,24 @@ export class TinyHyperGraphSolver extends BaseSolver {
})
}

onOutOfCandidates() {
onOutOfCandidates(): void {
const { topology, state } = this
const currentRouteId = state.currentRouteId
const maxRegionCostBeforeRip = this.getMaxRegionCost()

// An empty single-route search has nothing to move out of its way.
if (
this.problem.routeCount === 1 &&
!this.problem.initialAssignments?.length &&
maxRegionCostBeforeRip === 0 &&
state.portAssignment.every((netId) => netId === -1) &&
state.regionSegments.every((segments) => segments.length === 0)
) {
this.failed = true
this.error = `No path for ${this.getRouteConnectionId(0)}`
return
}

for (let regionId = 0; regionId < topology.regionCount; regionId++) {
const regionCost =
state.regionIntersectionCaches[regionId]?.existingRegionCost ?? 0
Expand Down
Loading
Loading