Avoid leakage of flows data between subsequent runs #260
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.
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)from,to,vehicle_volume(minimal input needed for congestion).PopulationTrips.inputs_hash(includes seed) +iteration+mode_name.Added congestion “variant/snapshot” assets (per run/iteration):
mobility/transport_graphs/congested_path_graph_snapshot.pymobility/transport_graphs/contracted_path_graph_snapshot.pymobility/transport_costs/path_travel_costs_snapshot.pyThese 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.pypassesrun_key=PopulationTrips.inputs_hashinto cost updates.mobility/choice_models/state_updater.pycallsTravelCostsAggregator.update(..., run_key, iteration).mobility/choice_models/travel_costs_aggregator.pybuildsVehicleODFlowsAssetand passes it toPathTravelCosts.update.Made
PathTravelCostsprefer the current snapshot forget(congestion=True):mobility/transport_costs/path_travel_costs.pystores a pointer to the latest snapshot.congestion=Truefalls back to free-flow to avoid reusing stale shared congested caches.