Compare commits
1 Commits
932a867720
...
2fe874e733
Author | SHA1 | Date |
---|---|---|
coolneng | 2fe874e733 |
|
@ -37,11 +37,9 @@ 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, furthest_index = get_furthest_element(
|
centroid, index = get_furthest_element(element=int(last_solution), data=data)
|
||||||
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(furthest_index)
|
data = data.drop(index)
|
||||||
return solutions
|
return solutions
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue