Skip to content

Conversation

@FlxPo
Copy link
Contributor

@FlxPo FlxPo commented Feb 3, 2026

Running multiple seeds (sequentially or in parallel) could contaminate congestion because OD flows and congested artifacts were written to shared fixed paths (e.g. path_graph_car/simplified/flows.parquet, travel_costs_congested_car.parquet). This produced bimodal / unstable results and made parallel runs unsafe.

Changes

  • Added a first-class flows asset:

    • mobility/transport_costs/od_flows_asset.py (VehicleODFlowsAsset)
    • Persists only from,to,vehicle_volume (minimal input needed for congestion).
    • Keyed by PopulationTrips.inputs_hash (includes seed) + iteration + mode_name.
    • Always writes a parquet with the expected schema (can be empty).
  • Added congestion “variant/snapshot” assets (per run/iteration):

    • mobility/transport_graphs/congested_path_graph_snapshot.py
    • mobility/transport_graphs/contracted_path_graph_snapshot.py
    • mobility/transport_costs/path_travel_costs_snapshot.py
      These depend on stable base artifacts + VehicleODFlowsAsset, producing isolated congested graphs/costs safe for parallel runs.
  • Rewired update propagation in the iterative loop:

    • mobility/choice_models/population_trips.py passes run_key=PopulationTrips.inputs_hash into cost updates.
    • mobility/choice_models/state_updater.py calls TravelCostsAggregator.update(..., run_key, iteration).
    • mobility/choice_models/travel_costs_aggregator.py builds VehicleODFlowsAsset and passes it to PathTravelCosts.update.
  • Made PathTravelCosts prefer the current snapshot for get(congestion=True):

    • mobility/transport_costs/path_travel_costs.py stores a pointer to the latest snapshot.
    • If no snapshot was applied, congestion=True falls back to free-flow to avoid reusing stale shared congested caches.

@codecov
Copy link

codecov bot commented Feb 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.42%. Comparing base (c8c3ac3) to head (680565d).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #260   +/-   ##
=======================================
  Coverage   70.42%   70.42%           
=======================================
  Files          56       56           
  Lines        2424     2424           
=======================================
  Hits         1707     1707           
  Misses        717      717           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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