diff --git a/evaluation/lib/benchmarks.py b/evaluation/lib/benchmarks.py index 14b4d6a1e346deeccd13f3a0008777b8247f0a8f..6ff017addd8cd2d29b2e6ff287399e72e076ad03 100644 --- a/evaluation/lib/benchmarks.py +++ b/evaluation/lib/benchmarks.py @@ -139,6 +139,9 @@ def init(graphs, charging_stations, conf, result_dir): ]) for map_name, G in zip(conf['maps'], graphs): + nodes = random.sample(list(G.nodes), k=2 * conf['queries_per_setup']) + start_nodes = nodes[:int(len(nodes) / 2)] + target_nodes = nodes[int(len(nodes) / 2):] for setup in conf['setups']: # Random adding of charging stations @@ -149,22 +152,15 @@ def init(graphs, charging_stations, conf, result_dir): with result_dir.joinpath(filename).open('a') as f: write_row(f, result_data) - # little hacky: get just created state graph from module cache - state_graph, _ = queries.CACHE[queries._cache_state_graph_key] - if len(state_graph.nodes) > 2: - # random start and target nodes of state graph - nodes = random.sample(list(state_graph.nodes), k=2 * conf['queries_per_setup']) - start_nodes = nodes[:int(len(nodes) / 2)] - target_nodes = nodes[int(len(nodes) / 2):] - - _run_queries( - G, - start_nodes, - target_nodes, - setup, - [queries.insert_nodes_into_state_graph], - result_dir - ) + # random start and target nodes of state graph + _run_queries( + G, + start_nodes, + target_nodes, + setup, + [queries.insert_nodes_into_state_graph], + result_dir + ) # Delete cached graphs for key in list(queries.CACHE.keys()): diff --git a/evaluation/lib/queries.py b/evaluation/lib/queries.py index 0a7a62ce4d07b6cf48cd1dff0bcd7c09e7364911..618e1317070b63897969fe5f8a8a637a4ea6c77a 100644 --- a/evaluation/lib/queries.py +++ b/evaluation/lib/queries.py @@ -159,12 +159,6 @@ def init_gasstation_queries(graph, conf): contracted_graph, contraction_time = get_contracted_graph(graph, conf, f) state_graph, state_graph_time = get_state_graph(contracted_graph, conf, f) - """ - start = perf_counter() - nx.shortest_path(state_graph, s, t) - runtime = perf_counter() - start - """ - return InitQueryRow( charging_stations=len(graph.charging_stations), time_contracted_graph=contraction_time, diff --git a/evaluation/run.py b/evaluation/run.py index e122465eea91415fd54f67929eccb4cd2f4d8d68..0fb15aefd36ad95c47707266c1b8f94cc1ea6e17 100644 --- a/evaluation/run.py +++ b/evaluation/run.py @@ -63,12 +63,17 @@ if __name__ == '__main__': nargs='+' ) + r = base.joinpath('results') + r.mkdir(exist_ok=True) + args = parser.parse_args() path: Path for path in args.configs: - benchmark_dir = base.joinpath('results', path.with_suffix('')) + benchmark_dir = r.joinpath(path.with_suffix('')) benchmark_dir.mkdir(exist_ok=True) + logging.info(f'Processing {path}..') + path = path.with_suffix('.yaml') with base.joinpath('configs/', path).open() as f: