Skip to content
Snippets Groups Projects
Commit 7e69416e authored by Matthieu Oberon's avatar Matthieu Oberon
Browse files

fix Elitis AS and MMAS strategies

parent 84a3a586
No related branches found
No related tags found
No related merge requests found
...@@ -95,7 +95,7 @@ def ACO(Me, NbP, comm, alpha, rho, Q, nb_ants, tau_0, n_iter, n1_max=256, n2_max ...@@ -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), :] best_p = paths[np.argmin(costs), :]
if fancy_strategy == 'ElitistAS': 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': if fancy_strategy == 'MMAS':
#we compute the best path locally #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 ...@@ -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 #we compute the pheromon using only the best path
tau = tau * (1-rho) 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 #verification of the threshold constraint
size = np.size(tau) size = np.size(tau)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment