Remove redundant code

This commit is contained in:
coolneng 2021-06-22 00:21:14 +02:00
parent 112f40d00f
commit fb5e9dc703
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
2 changed files with 0 additions and 11 deletions

View File

@ -22,16 +22,6 @@ def compute_distance(element, solution, data):
return accumulator 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): def element_in_dataframe(solution, element):
duplicates = solution.query(f"point == {element}") duplicates = solution.query(f"point == {element}")
return not duplicates.empty return not duplicates.empty

View File

@ -48,7 +48,6 @@ def memetic_algorithm(n, m, data, hybridation, max_iterations=100000):
population = evaluate_population(population, data) population = evaluate_population(population, data)
for i in range(max_iterations): for i in range(max_iterations):
if i % 10 == 0: if i % 10 == 0:
best_index, _ = get_best_elements(population)
population = run_local_search(n, data, population, mode=hybridation) population = run_local_search(n, data, population, mode=hybridation)
i += 5 i += 5
parents = select_parents(population, n, mode="stationary") parents = select_parents(population, n, mode="stationary")