diff --git a/src/processing.py b/src/processing.py index b2065a9..ced928f 100644 --- a/src/processing.py +++ b/src/processing.py @@ -45,10 +45,20 @@ def greedy_algorithm(n, m, data): # NOTE In each step, switch to the element that gives the least amount -def local_search(): +def local_search(n, m, data): pass +def execute_algorithm(choice, n, m, data): + if choice == "greedy": + return greedy_algorithm(n, m, data) + elif choice == "local": + return local_search(n, m, data) + else: + print("The valid algorithm choices are 'greedy' and 'local'") + exit(1) + + def show_results(solutions): distance_sum = solutions["distance"].sum() print(solutions) @@ -56,15 +66,18 @@ def show_results(solutions): def usage(argv): - print(f"Usage: python {argv[0]} ") + print(f"Usage: python {argv[0]} ") + print("algorithm choices:") + print("greedy: greedy algorithm") + print("local: local search algorithm") exit(1) def main(): - if len(argv) != 2: + if len(argv) != 3: usage(argv) n, m, data = parse_file(argv[1]) - solutions = greedy_algorithm(n, m, data) + solutions = execute_algorithm(choice=argv[2], n=n, m=m, data=data) show_results(solutions)