From a9fe4f1ae0cb49c37c006ad253c16eed4db361eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=20Kr=C3=BCger?= Date: Thu, 21 Jan 2021 02:46:39 +0100 Subject: [PATCH] added instance name and ext_nr to result csv --- main.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index cf1c5ca..5a5bb66 100644 --- a/main.py +++ b/main.py @@ -58,18 +58,32 @@ def parse_result(res_str): return res +def parse_instance_path(ipath): + name = pl.Path(ipath).name.strip() + + ext_nr = int(name[:-len(".cnf.bz2")][-4:]) + instance = name[:-len("_0000.cnf.bz2")] + + return instance, ext_nr + + + if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument("-i", "--instance", help="The instance.") args = parser.parse_args() - res_str = run_alg(args.instance) + + iname, ext_nr = parse_instance_path(args.instance) + res = parse_result(res_str) + + res_vals = [iname, str(ext_nr)] + list(map(str, res.values())) - print(','.join(map(str, res.values()))) + print(','.join(res_vals))