summaryrefslogtreecommitdiffstats
path: root/multiple_ant_colony_system.py
diff options
context:
space:
mode:
authorMitsuo Tokumori <[email protected]>2022-05-03 22:29:21 -0500
committerMitsuo Tokumori <[email protected]>2022-05-03 22:29:21 -0500
commit86240eac6b3889aa01c93e32978138572f87f81b (patch)
treece60b584eb3e2021ba77df56f5c0405f82eac4a4 /multiple_ant_colony_system.py
parent77fb174ac6f3cf1b8e0c78a1e68bd9dd42cf2065 (diff)
downloadVRPTW-ACO-python-86240eac6b3889aa01c93e32978138572f87f81b.tar.gz
VRPTW-ACO-python-86240eac6b3889aa01c93e32978138572f87f81b.tar.bz2
VRPTW-ACO-python-86240eac6b3889aa01c93e32978138572f87f81b.zip
Add some translations and sample input data
Diffstat (limited to 'multiple_ant_colony_system.py')
-rw-r--r--multiple_ant_colony_system.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/multiple_ant_colony_system.py b/multiple_ant_colony_system.py
index 45c896a..9305b95 100644
--- a/multiple_ant_colony_system.py
+++ b/multiple_ant_colony_system.py
@@ -183,10 +183,11 @@ class MultipleAntColonySystem:
:return:
"""
- # 最多可以使用vehicle_num辆车,即在path中最多包含vehicle_num+1个depot中,找到路程最短的路径,
- # vehicle_num设置为与当前的best_path一致
+ # At most vehicle_num vehicles can be used, that is, the path contains
+ # at most vehicle_num+1 depots to find the path with the shortest
+ # distance, vehicle_num is set to be consistent with the current best_path
print('[acs_time]: start, vehicle_num %d' % vehicle_num)
- # 初始化信息素矩阵
+ # Initialize the pheromone matrix
global_best_path = None
global_best_distance = None
ants_pool = ThreadPoolExecutor(ants_num)
@@ -206,13 +207,13 @@ class MultipleAntColonySystem:
ants_thread.append(thread)
ants.append(ant)
- # 这里可以使用result方法,等待线程跑完
+ # Here you can use the result method to wait for the thread to finish running
for thread in ants_thread:
thread.result()
ant_best_travel_distance = None
ant_best_path = None
- # 判断蚂蚁找出来的路径是否是feasible的,并且比全局的路径要好
+ # Determine whether the path found by ants is feasible and better than the global path
for ant in ants:
if stop_event.is_set():