From 5bf8e17c83d4b5500fd81edaee5c495161e1f0ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Thu, 13 Aug 2015 11:42:51 +0200 Subject: Fix generate single configuration This fixes and ensures that every call generates configuration. Unless False is returned. --- scripts/configurations.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/configurations.py b/scripts/configurations.py index 0b73a53..a9ede05 100644 --- a/scripts/configurations.py +++ b/scripts/configurations.py @@ -167,21 +167,22 @@ def __generate_single__(var_num, conf_num): else: with open(sf(conf.single_generated_file), 'r') as f: for ln in f: - measure_list.append(int(ln)) - if measure_list: + measure_list.add(int(ln)) + if not measure_list: return False tfile = __buildtempcnf__(var_num, (sf(conf.rules_file), sf(conf.fixed_file)), (str(measure_list.pop()))) + with open(sf(conf.single_generated_file), 'w') as fo: + fo.writelines(measure_list) try: confs = __exec_sat__(tfile, ['-i', '0']) for con in confs: __register_conf__(con, conf_num, 'single-sat') except exceptions.NoSolution: - pass + os.remove(tfile) + return __generate_single__(var_num, conf_num) finally: os.remove(tfile) - with open(sf(conf.single_generated_file), 'w') as fo: - fo.writelines(measure_list) return True def __generate_random__(var_num, conf_num): -- cgit v1.2.3