summaryrefslogtreecommitdiffstats
path: root/vrptw_base.py
diff options
context:
space:
mode:
Diffstat (limited to 'vrptw_base.py')
-rw-r--r--vrptw_base.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/vrptw_base.py b/vrptw_base.py
index e7e55bd..b92db7b 100644
--- a/vrptw_base.py
+++ b/vrptw_base.py
@@ -107,16 +107,16 @@ class VrptwGraph:
self.rho * self.init_pheromone_val
def global_update_pheromone(self, best_path, best_path_distance):
- """
- 更新信息素矩阵
- :return:
+ """Update pheromone trail on best path (T+)
+
+ Ant Colony System offline pheromone trail update
"""
self.pheromone_mat = (1-self.rho) * self.pheromone_mat
- current_ind = best_path[0]
- for next_ind in best_path[1:]:
- self.pheromone_mat[current_ind][next_ind] += self.rho/best_path_distance
- current_ind = next_ind
+ current_index = best_path[0]
+ for next_index in best_path[1:]:
+ self.pheromone_mat[current_index][next_index] += self.rho/best_path_distance
+ current_index = next_index
def nearest_neighbor_heuristic(self, max_vehicle_num=None):
"""Generate route plan using Nearest Neighbor (NN) heuristic
@@ -212,6 +212,7 @@ class VrptwGraph:
class PathMessage:
+ """Deep copy of travel_path?"""
def __init__(self, path, distance):
if path is not None:
self.path = copy.deepcopy(path)