urban_commuting: mission requirements, maintenance, cruise-speed decision
Some checks failed
tests / pytest (3.11) (push) Has been cancelled
tests / pytest (3.13) (push) Has been cancelled

- ratio-log normalization (scale-invariant) replacing log1p
- domain requirements (payload, trip_range) as hard mission constraints
- platform payload_ratio, rotorcraft hover floor (min_specific_power)
- maintenance_multiple + service_life folded into cost per metre
- cruise speed searched between domain speed floor and build top speed
- default-deny "domain" requires: Wind Sail / Gravity Coast need the
  domain to declare prevailing_wind / net_descent
- LOGIC DOCS/004: cost per passenger and infrastructure cost, tabled

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-09-25 23:12:36 -05:00
parent af401d6bc2
commit 60c36e5d27
12 changed files with 421 additions and 178 deletions

View File

@@ -37,9 +37,13 @@ class TestNormalize:
assert normalize(50.0, 100.0, 50.0) == 0.0
def test_zero_min(self):
"""norm_min=0 should work (log1p(0)=0)."""
result = normalize(0.5, 0.0, 1.0)
assert 0.0 < result < 1.0
"""norm_min=0 has no ratio to log -- falls back to linear."""
assert normalize(0.5, 0.0, 1.0) == 0.5
def test_scale_invariant(self):
"""Same ratio within the range -> same score, whatever the magnitude."""
assert abs(normalize(1e-4, 1e-5, 1e-3) - normalize(10.0, 1.0, 100.0)) < 1e-12
assert abs(normalize(10.0, 1.0, 100.0) - 0.5) < 1e-12
class TestCompositeScore:
@@ -110,5 +114,5 @@ class TestScorer:
cost_expensive = next(s for s in result_expensive.scores if s.metric_name == "cost_efficiency")
assert cost_cheap.normalized_score > cost_expensive.normalized_score
assert cost_cheap.normalized_score > 0.9 # near the best
assert cost_cheap.normalized_score > 0.85 # 2x the floor of a 200x range
assert cost_expensive.normalized_score < 0.1 # near the worst