Compare commits

..

1 Commits

Author SHA1 Message Date
coolneng 932a867720
Remove duplicates from the solutions 2021-04-11 22:22:18 +02:00
1 changed files with 4 additions and 2 deletions

View File

@ -37,9 +37,11 @@ def greedy_algorithm(n, m, data):
solutions = solutions.append(first_solution, ignore_index=True)
for _ in range(m):
last_solution = solutions["point"].tail(n=1)
centroid, index = get_furthest_element(element=int(last_solution), data=data)
centroid, furthest_index = get_furthest_element(
element=int(last_solution), data=data
)
solutions = solutions.append(dict(centroid), ignore_index=True)
data = data.drop(index)
data = data.drop(furthest_index)
return solutions