diff --git a/src/processing.py b/src/processing.py index c9f44b5..7578f3c 100644 --- a/src/processing.py +++ b/src/processing.py @@ -2,6 +2,7 @@ from preprocessing import parse_file from pandas import DataFrame from sys import argv from random import seed, randint +from time import time def get_first_solution(n, data): @@ -72,13 +73,14 @@ def execute_algorithm(choice, n, m, data): exit(1) -def show_results(solutions): +def show_results(solutions, time_delta): distance_sum = solutions["distance"].sum() duplicates = solutions.duplicated() print(solutions) print("Total distance: " + str(distance_sum)) if solutions[duplicates].empty: print("No duplicates found") + print("Execution time: " + str(time_delta)) def usage(argv): @@ -93,8 +95,10 @@ def main(): if len(argv) != 3: usage(argv) n, m, data = parse_file(argv[1]) + start_time = time() solutions = execute_algorithm(choice=argv[2], n=n, m=m, data=data) - show_results(solutions) + end_time = time() + show_results(solutions, time_delta=end_time - start_time) if __name__ == "__main__":