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:00 +0200 |
commit | 96825e484149a44d17e2f2330c8fe2ee4563259c (patch) | |
tree | f3c6cef75a2575679f89ae45de50f64fa0423841 /scripts | |
parent | 89aceeeafc21816b527c82c133744438eaa48f29 (diff) | |
download | linux-conf-perf-96825e484149a44d17e2f2330c8fe2ee4563259c.tar.gz linux-conf-perf-96825e484149a44d17e2f2330c8fe2ee4563259c.tar.bz2 linux-conf-perf-96825e484149a44d17e2f2330c8fe2ee4563259c.zip |
Implement random generation of configurations
Configuration are generated with random assumptions. This should
generate different configuration for every SAT solver execution.
Diffstat (limited to 'scripts')
-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 097f501..0b73a53 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() @@ -184,15 +185,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 |