Build TBTR dict¶
Builds data structure for TBTR related algorithms
-
builders.build_TBTR_dict.
algorithm1_parallel
(route_details: tuple) → list[source]¶ Collects all possible trip transfers.
- Parameters
route_details (list) – tuple of format: (route id, list of trips)
- Returns
list of trip-transfers format [(from trip id, from stop id, to strip id, to stop id)]
-
builders.build_TBTR_dict.
algorithm2_parallel
(trip_transfer_: list) → list[source]¶ Removes trip transfers which cause U-turns.
- Parameters
trip_transfer (list) – trip transfers. Format : [‘index’, ‘from_routeid’, ‘from_tid’, ‘to_routeid’, ‘to_tid’, ‘from_stop_index’, ‘to_stop_index’]
- Returns
Returns the index if the trip-transfer is optimal. Else empty list
-
builders.build_TBTR_dict.
algorithm3_parallel
(trip_details: tuple) → list[source]¶ Removes trip transfers that are not part of any optimal journey
- Parameters
trip_details (tuple) – tuple of form: (route_id, trip_id, trip)
- Returns
list of non-optimal trip transfers.
-
builders.build_TBTR_dict.
initialize
() → tuple[source]¶ Takes the required inputs for building TBTR preprocessing
- Returns
string CORES (int): Number of codes to be used change_time (int): change-time in seconds. GENERATE_LOGFILE (int): 1 to redirect and save a log file. Else 0 USE_PARALlEL (int): 1 for parallel and 0 for serial
- Return type
breaker (str)