diff --git a/Appli-iso3dfd/ACO.py b/Appli-iso3dfd/ACO.py index 377064882c90e2b36df7b62864e37112afbde47d..f84501bea14c92a56c5a73610a70400cb4a85cc7 100644 --- a/Appli-iso3dfd/ACO.py +++ b/Appli-iso3dfd/ACO.py @@ -103,8 +103,9 @@ 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), :] #we compare the best paths of all process and we save only the best one - recv_table = np.empty(2) - comm.Allreduce(np.array([best_cost, Me]), recv_table, OP=MPI.MINLOC) + recv_table = (0., 0) + send_table = (best_cost, Me) + recv_table = comm.allreduce(send_table, op=MPI.MINLOC) best_cost = recv_table[0] best_p = comm.bcast(best_p, root=recv_table[1]) @@ -113,13 +114,7 @@ def ACO(Me, NbP, comm, alpha, rho, Q, nb_ants, tau_0, n_iter, n1_max=256, n2_max 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) - for i in range(size[0]): - for j in range(size[1]): - if tau[i][j] < sub_threshold: - tau[i][j] = sub_threshold - if tau[i][j] > sup_threshold: - tau[i][j] = sup_threshold + np.clip(tau, sub_threshold, sup_threshold) #we update the best path on all iteration if best_cost < cost_opti: