You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Solve quasi Dynamic User Equilibrium (DUE) problem with departure time choice using day-to-day dynamics. WIP
923
+
924
+
Parameters
925
+
----------
926
+
func_World : function
927
+
function that returns a World object with nodes, links, and demand specifications
928
+
desired_arrival_time : float
929
+
desired arrival time to the destination in second
930
+
time_windows : list of float
931
+
Time windows for departure time. List of the start time of each time window in second. The final element denotes the end of the windows.
932
+
For example, `time_windows=[0,600,1200,1800]' means there are 3 windows, namely, 0-600 s, 600-1200 s, and 1200-1800 s.
933
+
alpha : float
934
+
travel time penalty coefficient per second
935
+
beta : float
936
+
early arrival penalty coefficient per second
937
+
gamma : float
938
+
late arrival penalty coefficient per second
939
+
insensitive_ratio : float
940
+
travelers become insensitive to the cost difference smaller than this ratio (i.e, bounded rationality, epsilon-Nash equilibirum)
941
+
942
+
Notes
943
+
-----
944
+
This function computes a near dynamic user equilibirum state as a steady state of day-to-day dynamical routing game.
945
+
946
+
This considers departure time choice as well as route choice.
947
+
948
+
Specifically, on day `i`, vehicles choose their route based on actual travel time on day `i-1` with the same departure time.
949
+
If there are shorter travel time route, they will change with probability `swap_prob`.
950
+
This process is repeated until `max_iter` day.
951
+
It is expected that this process eventually reach a steady state.
952
+
Due to the problem complexity, it does not necessarily reach or converge to Nash equilibrium or any other stationary points.
953
+
However, in the literature, it is argued that the steady state can be considered as a reasonable proxy for Nash equilibrium or dynamic equilibrium state.
954
+
There are some theoretical background for it; but intuitively speaking, the steady state can be considered as a realistic state that people's rational behavior will reach.
955
+
956
+
This method is based on the following literature:
957
+
Route choice equilibrium:
958
+
Ishihara, M., & Iryo, T. (2015). Dynamic Traffic Assignment by Markov Chain. Journal of Japan Society of Civil Engineers, Ser. D3 (Infrastructure Planning and Management), 71(5), I_503-I_509. (in Japanese). https://doi.org/10.2208/jscejipm.71.I_503
959
+
Iryo, T., Urata, J., & Kawase, R. (2024). Traffic Flow Simulator and Travel Demand Simulators for Assessing Congestion on Roads After a Major Earthquake. In APPLICATION OF HIGH-PERFORMANCE COMPUTING TO EARTHQUAKE-RELATED PROBLEMS (pp. 413-447). https://doi.org/10.1142/9781800614635_0007
960
+
Iryo, T., Watling, D., & Hazelton, M. (2024). Estimating Markov Chain Mixing Times: Convergence Rate Towards Equilibrium of a Stochastic Process Traffic Assignment Model. Transportation Science. https://doi.org/10.1287/trsc.2024.0523
961
+
962
+
Departure time choice equilibrium:
963
+
Satsukawa, K., Wada, K., & Iryo, T. (2024). Stability analysis of a departure time choice problem with atomic vehicle models. Transportation Research Part B: Methodological, 189, 103039. https://doi.org/10.1016/j.trb.2024.103039
964
+
965
+
"""
966
+
s.func_World=func_World
967
+
968
+
s.desired_arrival_time=desired_arrival_time
969
+
s.time_windows=time_windows
970
+
s.alpha=alpha
971
+
s.beta=beta
972
+
s.gamma=gamma
973
+
s.insensitive_ratio=insensitive_ratio
974
+
975
+
s.W_sol=None#final solution
976
+
s.W_intermid_solution=None#latest solution in the iterative process. Can be used when an user terminate the solution algorithm
977
+
s.dfs_link= []
978
+
979
+
warnings.warn("DTA solver is experimental and may not work as expected. It is functional but unstable.")
print(f"number of OD pairs: {len(dict_od_to_routes.keys())}, number of routes: {sum([len(val) forvalindict_od_to_routes.values()])}, number of departure time windows: {len(s.time_windows)}")
print(f' iter {i}: cost gap: {cost_gap_per_vehicle:.1f}, potential change: {potential_n_swap}, change: {n_swap}, total travel time: {W.analyzer.total_travel_time: .1f}, delay ratio: {W.analyzer.average_delay/W.analyzer.average_travel_time: .3f}')
1176
+
1177
+
ifcallback:
1178
+
callback(i, W)
1179
+
1180
+
s.route_log.append(route_actual)
1181
+
s.dep_t_log.append(dep_time_actual)
1182
+
s.cost_log.append(cost_actual)
1183
+
1184
+
s.ttts.append(int(W.analyzer.total_travel_time))
1185
+
s.n_swaps.append(n_swap)
1186
+
s.potential_swaps.append(potential_n_swap)
1187
+
s.cost_gaps.append(cost_gap_per_vehicle)
1188
+
1189
+
1190
+
s.end_time=time.time()
1191
+
1192
+
print("DUE summary:")
1193
+
last_iters=int(max_iter/4)
1194
+
print(f" total travel time: initial {s.ttts[0]:.1f} -> average of last {last_iters} iters {np.average(s.ttts[-last_iters:]):.1f}")
1195
+
print(f" number of potential changes: initial {s.potential_swaps[0]:.1f} -> average of last {last_iters} iters {np.average(s.potential_swaps[-last_iters:]):.1f}")
1196
+
print(f" cost gap: initial {s.cost_gaps[0]:.1f} -> average of last {last_iters} iters {np.average(s.cost_gaps[-last_iters:]):.1f}")
plt.title("travel time difference between choosen route and minimum cost route")
1217
+
plt.plot(s.t_gaps)
1218
+
plt.ylim(0,None)
1219
+
plt.xlabel("iter")
1220
+
1221
+
plt.show()
1222
+
1223
+
# plt.figure()
1224
+
# plot_multiple_y(ys=[s.ttts, s.n_swaps, s.potential_swaps, s.total_t_gaps, np.array(s.total_t_gaps)/np.array(s.potential_swaps)], labels=["total travel time", "number of route change", "number of potential route change", "time gap for potential route change", "time gap per potential route change"])
0 commit comments