Skip to content

Repair, overhaul and replace policy with cycles - #373

Merged
derrynknife merged 2 commits into
devfrom
feat/k-cycle-policy
Nov 3, 2026
Merged

derrynknife merged 2 commits into
devfrom
feat/k-cycle-policy

Conversation

@derrynknife

Copy link
Copy Markdown
Owner

Adds Repairable.overhaul_replace_cost_rate(interval, cycles, overhaul_factor, replacement_cost) and optimal_overhaul_replace_policy(overhaul_factor, replacement_cost, max_cycles=20) returning an OverhaulReplacePolicy(interval, cycles, cost_rate).

In plain words: failures are repaired minimally, every interval the unit is overhauled (cost co, keeping a share overhaul_factor of its age), and after cycles periods it is replaced (replacement_cost). Exact (no simulation) for an analytic cif model: period j starts at the age the overhauls leave, expects L(v+T)-L(v) failures, and the renewal-reward cost rate is (cr * repairs + (K-1) co + cp) / (K T). One period is the existing periodic replacement.

Checked against closed forms (constant failure rate, full-renewal overhaul, a hand-worked two-period cycle, the power-law periodic replacement optimum), optimal_overhaul_policy for K=1, and a seeded simulation of failure times by inverting the intensity. Simulation-backed models are refused. Docs, changelog and result type added. Not covered: overhaul triggered by a failure count (rather than an interval).

🤖 Generated with Claude Code

https://claude.ai/code/session_019Km2eWBiPJ5JNkme3vRg4B

derrynknife and others added 2 commits November 3, 2026 18:51
Repairable.overhaul_replace_cost_rate() and optimal_overhaul_replace_policy():
minimal repair at failures, an age-reducing overhaul every interval, and
a replacement after K periods; exact for an analytic model.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019Km2eWBiPJ5JNkme3vRg4B
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019Km2eWBiPJ5JNkme3vRg4B
@derrynknife
derrynknife merged commit 34932dc into dev Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant