From 7e69416e772500128cdc80b4093f47b86b035250 Mon Sep 17 00:00:00 2001 From: alberich <matthieu.oberon@student-cs.fr> Date: Wed, 31 Mar 2021 11:29:02 +0200 Subject: [PATCH] fix Elitis AS and MMAS strategies --- Appli-iso3dfd/ACO.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Appli-iso3dfd/ACO.py b/Appli-iso3dfd/ACO.py index cd3f9eb..204cdd6 100644 --- a/Appli-iso3dfd/ACO.py +++ b/Appli-iso3dfd/ACO.py @@ -95,7 +95,7 @@ def ACO(Me, NbP, comm, alpha, rho, Q, nb_ants, tau_0, n_iter, n1_max=256, n2_max best_p = paths[np.argmin(costs), :] if fancy_strategy == 'ElitistAS': - tau = tools.add_pheromones(tau, np.array(best_p), np.array(best_cost), Q, n1_size, n2_size, n3_size, n_cbx, n_cby) + tau = tools.add_pheromones(tau, np.array([best_p]), np.array([[best_cost]]), Q, n1_size, n2_size, n3_size, n_cbx, n_cby) if fancy_strategy == 'MMAS': #we compute the best path locally @@ -110,7 +110,7 @@ def ACO(Me, NbP, comm, alpha, rho, Q, nb_ants, tau_0, n_iter, n1_max=256, n2_max #we compute the pheromon using only the best path tau = tau * (1-rho) - tau = tools.add_pheromones(tau, np.array(best_p), np.array(best_cost), Q, n1_size, n2_size, n3_size, n_cbx, n_cby) + tau = tools.add_pheromones(tau, np.array([best_p]), np.array([[best_cost]]), Q, n1_size, n2_size, n3_size, n_cbx, n_cby) #verification of the threshold constraint size = np.size(tau) -- GitLab