From fb5e9dc703f2769dfbbf35e112a03ed68f5680fa Mon Sep 17 00:00:00 2001 From: coolneng Date: Tue, 22 Jun 2021 00:21:14 +0200 Subject: [PATCH] Remove redundant code --- src/local_search.py | 10 ---------- src/memetic_algorithm.py | 1 - 2 files changed, 11 deletions(-) diff --git a/src/local_search.py b/src/local_search.py index 8e22d14..e7759d0 100644 --- a/src/local_search.py +++ b/src/local_search.py @@ -22,16 +22,6 @@ def compute_distance(element, solution, data): return accumulator -def get_first_random_solution(n, m, data): - solution = DataFrame(columns=["point", "distance"]) - seed(42) - solution["point"] = choice(n, size=m, replace=False) - solution["distance"] = solution["point"].apply( - func=compute_distance, solution=solution, data=data - ) - return solution - - def element_in_dataframe(solution, element): duplicates = solution.query(f"point == {element}") return not duplicates.empty diff --git a/src/memetic_algorithm.py b/src/memetic_algorithm.py index 9a07df0..1cefe86 100644 --- a/src/memetic_algorithm.py +++ b/src/memetic_algorithm.py @@ -48,7 +48,6 @@ def memetic_algorithm(n, m, data, hybridation, max_iterations=100000): population = evaluate_population(population, data) for i in range(max_iterations): if i % 10 == 0: - best_index, _ = get_best_elements(population) population = run_local_search(n, data, population, mode=hybridation) i += 5 parents = select_parents(population, n, mode="stationary")