diff options
Diffstat (limited to 'multiple_ant_colony_system.py')
| -rw-r--r-- | multiple_ant_colony_system.py | 11 |
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(): |
