Compare commits
1 Commits
2fe874e733
...
932a867720
Author | SHA1 | Date |
---|---|---|
coolneng | 932a867720 |
|
@ -37,9 +37,11 @@ def greedy_algorithm(n, m, data):
|
||||||
solutions = solutions.append(first_solution, ignore_index=True)
|
solutions = solutions.append(first_solution, ignore_index=True)
|
||||||
for _ in range(m):
|
for _ in range(m):
|
||||||
last_solution = solutions["point"].tail(n=1)
|
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)
|
solutions = solutions.append(dict(centroid), ignore_index=True)
|
||||||
data = data.drop(index)
|
data = data.drop(furthest_index)
|
||||||
return solutions
|
return solutions
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue