From b8b1fe936835279231e72046ff9d8e295cc3a374 Mon Sep 17 00:00:00 2001 From: coolneng Date: Thu, 20 May 2021 19:28:06 +0200 Subject: [PATCH] Execute greedy algorithm only once --- src/execution.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/execution.py b/src/execution.py index a52cb36..ba28325 100644 --- a/src/execution.py +++ b/src/execution.py @@ -59,19 +59,17 @@ def script_execution(filenames, greedy, local, iterations=3): script = "src/main.py" for dataset in filenames: print(f"Running on dataset {dataset}") - greedy_list = [] + greedy_cmd = run( + [executable, script, dataset, "greedy"], capture_output=True + ).stdout.splitlines() local_list = [] for _ in range(iterations): - greedy_cmd = run( - [executable, script, dataset, "greedy"], capture_output=True - ).stdout.splitlines() local_cmd = run( [executable, script, dataset, "local"], capture_output=True ).stdout.splitlines() - greedy_list.append(greedy_cmd) local_list.append(local_cmd) greedy, local = populate_dataframes( - greedy, local, greedy_list, local_list, dataset + greedy, local, greedy_cmd, local_list, dataset ) return greedy, local