Skip to content
Merged
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
8 changes: 7 additions & 1 deletion lib/outside-in-partial-rip-tiny-hypergraph-solver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1040,8 +1040,14 @@ export class OutsideInPartialRipTinyHyperGraphSolver extends DistanceAwareTinyHy
this.RIP_THRESHOLD_RAMP_ATTEMPTS,
this.PARTIAL_RIP_MAX_ATTEMPTS,
)
const ripThresholdRampAttempts = Math.max(
0,
this.RIP_THRESHOLD_RAMP_ATTEMPTS,
)
const ripThresholdProgress =
maxRipAttempts <= 0 ? 1 : Math.min(1, state.ripCount / maxRipAttempts)
ripThresholdRampAttempts <= 0
? 1
: Math.min(1, state.ripCount / ripThresholdRampAttempts)
const currentRipThreshold =
this.RIP_THRESHOLD_START +
(this.RIP_THRESHOLD_END - this.RIP_THRESHOLD_START) * ripThresholdProgress
Expand Down
16 changes: 16 additions & 0 deletions tests/outside-in-partial-rip-tiny-hypergraph-solver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,22 @@ test("the configured warmup performs a whole-graph rerip first", () => {
expect(solver.stats.partialRipCount ?? 0).toBe(0)
})

test("the partial-rip cap does not compress the threshold ramp", () => {
const solver = createLinearSolver(24, {
RIP_THRESHOLD_START: 0.05,
RIP_THRESHOLD_END: 0.8,
RIP_THRESHOLD_RAMP_ATTEMPTS: 10,
PARTIAL_RIP_MAX_ATTEMPTS: 1,
})
solver.state.ripCount = 1
solver.state.regionIntersectionCaches[3]!.existingRegionCost = 1

solver.onAllRoutesRouted()

expect(solver.solved).toBe(true)
expect(solver.stats.currentRipThreshold).toBeCloseTo(0.125)
})

test("complexity-aware selection activates only at its route-count gate", () => {
const belowGateSolver = createLinearSolver(24, {
PARTIAL_RIP_MAX_ATTEMPTS: 0,
Expand Down
Loading