summaryrefslogtreecommitdiffstats
path: root/vrptw_base.py
diff options
context:
space:
mode:
authorMitsuo Tokumori <[email protected]>2022-04-28 02:55:35 -0500
committerMitsuo Tokumori <[email protected]>2022-04-28 02:55:35 -0500
commit77fb174ac6f3cf1b8e0c78a1e68bd9dd42cf2065 (patch)
tree82b4ba211c1f93060562f9159819e37c785a6779 /vrptw_base.py
parent453a2ae1d15f3fcb197f17974c8541216c4baded (diff)
downloadVRPTW-ACO-python-77fb174ac6f3cf1b8e0c78a1e68bd9dd42cf2065.tar.gz
VRPTW-ACO-python-77fb174ac6f3cf1b8e0c78a1e68bd9dd42cf2065.tar.bz2
VRPTW-ACO-python-77fb174ac6f3cf1b8e0c78a1e68bd9dd42cf2065.zip
Add some translations and odiparpack directory
Inside odiparpack is input data related of our instance of the MDHVRPTW (Multi-Depot Heteregenous VRPTW)
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)