Add function to show results

This commit is contained in:
coolneng 2021-04-12 11:12:46 +02:00
parent f534521410
commit 6a3bdc44e3
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
1 changed files with 7 additions and 1 deletions

View File

@ -49,6 +49,12 @@ def local_search():
pass
def show_results(solutions):
distance_sum = solutions["distance"].sum()
print(solutions)
print("Total distance: " + str(distance_sum))
def usage(argv):
print(f"Usage: python {argv[0]} <file>")
exit(1)
@ -59,7 +65,7 @@ def main():
usage(argv)
n, m, data = parse_file(argv[1])
solutions = greedy_algorithm(n, m, data)
print(solutions)
show_results(solutions)
if __name__ == "__main__":