Minor refactor in results report

This commit is contained in:
coolneng 2021-04-15 18:35:31 +02:00
parent 1cf8a2696a
commit 98a86a97c0
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
1 changed files with 2 additions and 3 deletions

View File

@ -15,7 +15,6 @@ def get_first_solution(n, data):
) )
furthest_index = distance_sum["distance"].astype(float).idxmax() furthest_index = distance_sum["distance"].astype(float).idxmax()
furthest_row = distance_sum.iloc[furthest_index] furthest_row = distance_sum.iloc[furthest_index]
furthest_row["distance"] = 0
return furthest_row return furthest_row
@ -105,10 +104,10 @@ def execute_algorithm(choice, n, m, data):
def show_results(solutions, time_delta): def show_results(solutions, time_delta):
distance_sum = solutions["distance"].sum() distance_sum = solutions["distance"].sum()
duplicates = solutions.duplicated() duplicates = solutions.duplicated().any()
print(solutions) print(solutions)
print("Total distance: " + str(distance_sum)) print("Total distance: " + str(distance_sum))
if solutions[duplicates].empty: if not duplicates:
print("No duplicates found") print("No duplicates found")
print("Execution time: " + str(time_delta)) print("Execution time: " + str(time_delta))