residual_demand_traffic_distribution_model

class pyrecodes.resource_distribution_model.residual_demand_traffic_distribution_model.ResidualDemandTrafficDistributionModel(resource_name: str, resource_parameters: dict, components: list[Component])

Bases: AbstractResourceDistributionModel

distribute(time_step: int) None
Calculate travel times if the model is supposed to distribute traffic at this time step.
If not, append an empty list to the travel_times list to keep the length of the list consistent with the number of time steps.
distribute_traffic() None
Run the traffic simulator to calculate travel times.
Supress output to the console from low-level libraries.
get_total_consumption(scope: str) float
Consumption of the transportation service is the number of agents whose travel time is not extended beyond the pre-disaster time times the TRIP_CUTOFF_THRESHOLD.
If traffic is not distributed at the current time step, consumption is 0.
get_total_demand(scope: str) float
Demand for the transportation service is the number of agents that need to travel from one location to another.
If traffic is not distributed at the current time step, demand is 0.
get_total_supply(scope: str) float

Supply is calculated the same as consumption.

update_r2d_dict()
Method to update the r2d_dict based on the current state of the components.
At the moment, the r2d_dict is created from scratch at each time step. Not efficient, optimize later.