From 32eac42e7b16c31cbabe3b823244660a21cfb68b Mon Sep 17 00:00:00 2001 From: coolneng Date: Mon, 21 Jun 2021 19:51:42 +0200 Subject: [PATCH] Take into account local search iterations --- src/local_search.py | 2 +- src/memetic_algorithm.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/local_search.py b/src/local_search.py index 79a6bfc..8e22d14 100644 --- a/src/local_search.py +++ b/src/local_search.py @@ -69,6 +69,6 @@ def explore_neighbourhood(element, n, data, max_iterations=100000): def local_search(first_solution, n, data): best_solution = explore_neighbourhood( - element=first_solution, n=n, data=data, max_iterations=50 + element=first_solution, n=n, data=data, max_iterations=5 ) return best_solution diff --git a/src/memetic_algorithm.py b/src/memetic_algorithm.py index 0308150..2f25fcc 100644 --- a/src/memetic_algorithm.py +++ b/src/memetic_algorithm.py @@ -37,6 +37,7 @@ def memetic_algorithm(n, m, data, hybridation, max_iterations=100000): if i % 10 == 0: best_index, _ = get_best_elements(population) run_local_search(n, data, population, mode=hybridation) + i += 5 parents = select_parents(population, n, mode="stationary") offspring = crossover(mode="position", parents=parents, m=m) offspring = mutate(offspring, n, data)