Skip to content

Commit f152817

Browse files
committed
minor updates
1 parent 6a171e3 commit f152817

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

tests/test_verification_dta_solvers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ def create_World():
113113
solver_DSO_GA.plot_vehicle_stats(orig="4", dest="7")
114114

115115
solver_DSO_ALNS.plot_convergence()
116+
solver_DUE.plot_link_stats()
117+
solver_DUE.plot_vehicle_stats(orig="4", dest="7")
116118

117119
solver_DSO_D2D.plot_convergence()
118120
solver_DSO_D2D.plot_link_stats()

uxsim/DTAsolvers/DTAsolvers.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -621,16 +621,13 @@ def plot_vehicle_stats(s, orig=None, dest=None):
621621
with error bars representing the standard deviation.
622622
"""
623623

624-
ave_TT = []
625-
std_TT = []
624+
sol_TT = []
626625
depature_time = []
627626
for vehid in s.route_log[0].keys():
628627
if (s.W_sol.VEHICLES[vehid].orig.name == orig or orig == None) and (s.W_sol.VEHICLES[vehid].dest.name == dest or dest == None):
629-
length = len(s.route_log)
630-
ts = [s.cost_log[day][vehid] for day in range(int(length/2), length)]
631-
ave_TT.append(np.average(ts))
632-
std_TT.append(np.std(ts))
633628
depature_time.append(s.W_sol.VEHICLES[vehid].departure_time_in_second)
629+
r, ts = s.W_sol.VEHICLES[vehid].traveled_route()
630+
sol_TT.append(ts[-1]-ts[0])
634631

635632
plt.figure()
636633
orig_ = orig
@@ -640,8 +637,7 @@ def plot_vehicle_stats(s, orig=None, dest=None):
640637
if dest == None:
641638
dest_ = "any"
642639
plt.title(f"orig: {orig_}, dest: {dest_}")
643-
plt.errorbar(x=depature_time, y=ave_TT, yerr=std_TT,
644-
fmt='bx', ecolor="#aaaaff", capsize=0, label=r"travel time (mean $\pm$ std)")
640+
plt.plot(depature_time, sol_TT, "bx", label=r"travel time (in DSO)")
645641
plt.xlabel("departure time of vehicle")
646642
plt.ylabel("travel time")
647643
plt.legend()
@@ -666,8 +662,12 @@ def __init__(s, func_World):
666662
s.W_sol = None #final solution
667663
s.W_intermid_solution = None #latest solution in the iterative process. Can be used when an user terminate the solution
668664
s.dfs_link = []
669-
670-
#warnings.warn("DTA solver is experimental and may not work as expected. It is functional but unstable.")
665+
666+
warnings.warn(
667+
"`SolverDSO_GA` is deprecated. Please consider to use `SolverDSO_D2D`, which is much more efficient.",
668+
DeprecationWarning
669+
)
670+
671671

672672
def solve(s, max_iter, n_routes_per_od=10, pop_size=50, elite_size=2, mutation_occur_rate=0.1, mutation_gene_rate=0.05, n_crossover_points=2, print_progress=True, initial_solution_World=None):
673673
"""
@@ -1048,6 +1048,11 @@ def __init__(s, func_World):
10481048
s.W_intermid_solution = None
10491049
s.dfs_link = []
10501050

1051+
warnings.warn(
1052+
"`SolverDSO_GA` is deprecated. Please consider to use `SolverDSO_D2D`, which is much more efficient.",
1053+
DeprecationWarning
1054+
)
1055+
10511056
def solve(s, max_iter, n_routes_per_od=10, k_max=None, k_min=None, p0=0.2, trials=50, always_accept=False, print_progress=True, initial_solution_World=None, destroy_set=None, repair_set=None):
10521057
"""
10531058
Solve Dynamic System Optimum (DSO) problem using a customized Adaptive Large Neighborhood Search (ADLS).

uxsim/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from .analyzer import *
44
from .scenario_reader_writer import *
55

6-
__version__ = "1.9.1"
6+
__version__ = "1.10.0"
77
__author__ = "Toru Seo"
88
__copyright__ = "Copyright (c) 2023 Toru Seo"
99
__license__ = "MIT License"

0 commit comments

Comments
 (0)