From 5b932339156d2a133e20ce0829d3cbd79fb8ef2b Mon Sep 17 00:00:00 2001 From: Johannes Erwerle Date: Fri, 16 Sep 2022 17:14:45 +0200 Subject: [PATCH] some small changes to the evaluation scripts --- utils/plot_results.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/utils/plot_results.py b/utils/plot_results.py index f72a1e1..12828fa 100755 --- a/utils/plot_results.py +++ b/utils/plot_results.py @@ -6,6 +6,7 @@ from csv import writer from typing import Tuple, List import re import numpy as np +from pprint import pprint import matplotlib.pyplot as plt @@ -17,7 +18,7 @@ path = argv[1] files = [f for f in os.listdir(path) if os.path.isfile(f"{ path }/{f}")] -files = [f for f in files if re.match(r"greedy_64_.+", f) is not None ] +# files = [f for f in files if re.match(r"greedy_64_.+", f) is not None ] def parse_file(file: str) -> Tuple[float, List[int]]: @@ -53,7 +54,7 @@ with open("times.csv", "w+") as times_file: full_path = f"{ path }/{ file }" time, pop = parse_file(full_path) - total_pops = sum(pop) + total_pops = sum(pop)/len(pop) results[name] = (total_pops, time) @@ -61,19 +62,25 @@ with open("times.csv", "w+") as times_file: pops.writerow([name, *pop]) rel_pops = list() +abs_pops = list() rel_time = list() +abs_time = list() labels = list() -# base_pops = results["dijkstra"][0] -# base_time = results["dijkstra"][1] -base_pops = results["greedy_64_1"][0] -base_time = results["greedy_64_1"][1] + + +pprint(results) +baseline = "dijkstra" +base_pops = results[baseline][0] +base_time = results[baseline][1] for name, values in results.items(): pops, time = values labels.append(name) rel_pops.append(pops/base_pops) rel_time.append(time/base_time) + abs_pops.append(pops) + abs_time.append(time) @@ -81,8 +88,8 @@ x = np.arange(len(labels)) # the label locations width = 0.35 # the width of the bars fig, ax = plt.subplots() -rects1 = ax.bar(x - width/2, rel_time , width, label='time') -rects2 = ax.bar(x + width/2, rel_pops, width, label='pops') +rects1 = ax.bar(x - width/2, abs_time , width, label='time') +# rects2 = ax.bar(x + width/2, abs_pops, width, label='pops') ax.legend() ax.set_xticks(x, labels)