Take into account local search iterations
This commit is contained in:
parent
f61cb7002e
commit
32eac42e7b
|
@ -69,6 +69,6 @@ def explore_neighbourhood(element, n, data, max_iterations=100000):
|
||||||
|
|
||||||
def local_search(first_solution, n, data):
|
def local_search(first_solution, n, data):
|
||||||
best_solution = explore_neighbourhood(
|
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
|
return best_solution
|
||||||
|
|
|
@ -37,6 +37,7 @@ def memetic_algorithm(n, m, data, hybridation, max_iterations=100000):
|
||||||
if i % 10 == 0:
|
if i % 10 == 0:
|
||||||
best_index, _ = get_best_elements(population)
|
best_index, _ = get_best_elements(population)
|
||||||
run_local_search(n, data, population, mode=hybridation)
|
run_local_search(n, data, population, mode=hybridation)
|
||||||
|
i += 5
|
||||||
parents = select_parents(population, n, mode="stationary")
|
parents = select_parents(population, n, mode="stationary")
|
||||||
offspring = crossover(mode="position", parents=parents, m=m)
|
offspring = crossover(mode="position", parents=parents, m=m)
|
||||||
offspring = mutate(offspring, n, data)
|
offspring = mutate(offspring, n, data)
|
||||||
|
|
Loading…
Reference in New Issue