Add function to show results
This commit is contained in:
parent
f534521410
commit
6a3bdc44e3
|
@ -49,6 +49,12 @@ def local_search():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def show_results(solutions):
|
||||||
|
distance_sum = solutions["distance"].sum()
|
||||||
|
print(solutions)
|
||||||
|
print("Total distance: " + str(distance_sum))
|
||||||
|
|
||||||
|
|
||||||
def usage(argv):
|
def usage(argv):
|
||||||
print(f"Usage: python {argv[0]} <file>")
|
print(f"Usage: python {argv[0]} <file>")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
@ -59,7 +65,7 @@ def main():
|
||||||
usage(argv)
|
usage(argv)
|
||||||
n, m, data = parse_file(argv[1])
|
n, m, data = parse_file(argv[1])
|
||||||
solutions = greedy_algorithm(n, m, data)
|
solutions = greedy_algorithm(n, m, data)
|
||||||
print(solutions)
|
show_results(solutions)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in New Issue