Fix wording/tests: marginal_freight docstring, structural simulate() check

- marginal_freight()'s docstring claimed small additions "cost ~0" if
  they fit in slack - the code is actually a continuous amortized rate
  with no such threshold. Fixed the wording to match the real behavior.
- The one known failing test asserted fixed money values from a 2026-09-18
  screenshot against live, drifting market prices - removed that
  assertion (it was testing market drift, not code correctness) but kept
  the exact area check. Replaced with a structural, price-independent
  regression check instead of just deleting: degradation == prod_cost/180
  and plan_cost == prod_cost+infra_cost+cm_cost, asserted directly from
  simulate()'s own fields, holds at any price.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-10-10 23:06:55 +02:00
co-authored by Claude Sonnet 5
parent 3f67cc7ed5
commit 3ee26e5a85
2 changed files with 21 additions and 12 deletions
+5 -3
View File
@@ -107,9 +107,11 @@ def trip_tonnage(flows: dict, mats: dict):
def marginal_freight(r_b, r_a, planet_id, cx, sf_price, ff_price, mats):
"""AIC/day freight for the EXTRA trips this addition requires - not the base's whole freight
bill. If the addition's materials fit in slack the base's existing traffic already has (the
common case for a small addition), this comes out to ~0: real freight cost only kicks in once
net t/m3 crosses into needing another round trip. Returns (freight_aic_per_day, note)."""
bill. Continuous amortized rate (extra tonnage/cargo-hold x round-trip cost), proportional to
the addition's own tonnage, not a step function - a small addition gets a small freight charge,
not exactly zero (that would need a real per-trip ceiling/rounding this doesn't model). Still
catches a recipe whose ROI looks great only because its freight cost was left out. Returns
(freight_aic_per_day, note)."""
origin = shipping.cx_system(cx)
if origin is None:
return 0.0, f"no station found for CX {cx!r} - freight not modelled"