Take into account local search iterations

This commit is contained in:
coolneng 2021-06-21 19:51:42 +02:00
parent f61cb7002e
commit 32eac42e7b
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
2 changed files with 2 additions and 1 deletions

View File

@ -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

View File

@ -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)