Repository navigation
Credit a unit's own salvage and retirement in switch times, logs and services - #511
Merged
Merged
Conversation
…services best_switch_time, plan_vs_actual and a service's task_value refused a unit's own salvage or retirement. best_switch_time now scans up to the retirement and credits every candidate's runs the salvage, reporting it as npv_distribution does; plan_vs_actual values the plan and the rest from today to the retirement, the salvage credited there as expected_npv credits it, and lists the salvage among what a log does not record; task_value runs each side to its plan's retirement, credits its salvage in the period it falls in, and does no service after it. With nothing left refusing them, the refusal goes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6RpnXB87vwhYETeh7ihtA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
best_switch_time,plan_vs_actualand a service'stask_valueused to refuse a unit's ownretire_atandsalvage. They now credit them, asexpected_npvandnpv_distributionalready do:best_switch_timescans switch times up to the retirement and adds the salvage to every run of every candidate. The candidates share a seed, so the choice of switch time is unchanged. The result gainssalvage,undiscounted_salvageandretire_at, asNPVDistributionhas.plan_vs_actualvalues the plan, and the rest from today, up to the retirement, crediting the salvage there throughexpected_npv. A salvage by age is taken from the unit's state today. The salvage is listed among what a log does not record. Anowpast the retirement is refused, and the message names the fix.task_valuewithServicesruns each side to the plan's retirement and credits the salvage in the period it falls in. No service is done after the retirement, and a note says how many were dropped.Nothing calls
_npv.refuse_own_endany more, so it is removed, and_require_priceableloses its flag. A salvage by age in simulated runs, and one unit retiring inside a larger diagram, are still refused, and the messages say what to give instead.Type of change
Checklist
test_npv_runs_own_end.py). Each new result is checked against the same calculation without the unit's own end, run from the same seed, plus the salvage:best_switch_timecandidate by candidate,plan_vs_actual's plan, rest and revalued NPVs, and the service's two sides.analysis_routesupdated: the refusals are gone from both routes; the catalogue's "a plan valued alone" case passesCHANGELOG.mdupdatedNotes for reviewers
Tests run: plan alone, plan vs actual, switch-time diagram, schedule services, NPV distribution, schedule value and result objects (307 passed, 1 skipped). After the last edits, the own-end tests, switch-time tests, plan-alone tests and the routes case were run again (225 passed). Results without the unit's own end are unchanged.
Generated by Claude Code