diff options
author | Karel Kočí <cynerd@email.cz> | 2015-08-13 11:04:31 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2015-08-13 11:08:30 +0200 |
commit | 57b76964ed0397cb48458c1a55acaeb19c287d45 (patch) | |
tree | 8e3d6236ddef31907cf57f835c19b904b0b338f1 | |
parent | 84b4681184165888f26e8988a705764baad18e64 (diff) | |
download | linux-conf-perf-57b76964ed0397cb48458c1a55acaeb19c287d45.tar.gz linux-conf-perf-57b76964ed0397cb48458c1a55acaeb19c287d45.tar.bz2 linux-conf-perf-57b76964ed0397cb48458c1a55acaeb19c287d45.zip |
Implement random generation of configurations
Configuration are generated with random assumptions. This should
generate different configuration for every SAT solver execution.
-rw-r--r-- | scripts/configurations.py | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/scripts/configurations.py b/scripts/configurations.py index aaa6937..0a15d5f 100644 --- a/scripts/configurations.py +++ b/scripts/configurations.py @@ -149,13 +149,14 @@ def __register_conf__(con, conf_num, generator): if os.path.isfile(filen): if compare(filen, wfile): print("I: Generated existing configuration.") - return + return False else: print("W: Generated configuration with collision hash.") # TODO this might have to be tweaked raise Exception() shutil.move(wfile, filen) dtb.add_configuration(hsh, hshf, generator) + return True def __generate_single__(var_num, conf_num): measure_list = set() @@ -185,15 +186,15 @@ def __generate_single__(var_num, conf_num): return True def __generate_random__(var_num, conf_num): - # TODO - #tfile = __buildtempcnf__(var_num, (sf(conf.rules_file), sf(conf.fixed_file)), ()) - #try: - #confs = __exec_sat__(tfile, []) - #for con in confs: - #__register_conf__(con, conf_num) - #finally: - #os.remove(tfile) - return False + tfile = __buildtempcnf__(var_num, (sf(conf.rules_file), sf(conf.fixed_file)), ()) + try: + confs = __exec_sat__(tfile, ['-i', '3']) + for con in confs: + if not __register_conf__(con, conf_num, 'random-sat'): + __generate_random__(var_num, conf_num) + finally: + os.remove(tfile) + return True def generate(): """Collect boolean equations from files rules and required |