parser = OptionParser("usage: %prog [options] [INPUT ...]", description=HELP) parallel.populate_option_parser(parser) parser.add_option("--relax", help="generate relaxed problem", action="store_true", default=False, dest="relax") options, args = parser.parse_args() options.suite = suites.build_suite(args) return options if __name__ == "__main__": options = parse_options() def run_problem(problem, log_func): log_func("Translating %s..." % problem) success = actions.do_translate(problem, generate_relaxed_problem=options.relax) if not success: return "Translating %s failed, skipping preprocess." % problem log_func("Preprocessing %s..." % problem) success = actions.do_preprocess(problem) if not success: return "Preprocessing %s failed." % problem return None parallel.run_jobs(options.jobs, options.suite, run_problem)
def read_experiment_file(filename): glob = {} execfile(filename, glob, EXPERIMENT) def main(): options = parse_options() setup_experiment_settings(options) jobs = [(problem, config) for problem in EXPERIMENT["suite_tasks"] for config in EXPERIMENT["configurations"]] print jobs def run_problem((problem, config), log_func): log_func("Solving %s with %s..." % (problem, config)) err_msg = actions.do_search(problem, config, EXPERIMENT["timeout"], EXPERIMENT["memory"], EXPERIMENT["debug"]) return err_msg tools.log( "Solving %d problems in %d configurations." % (len(EXPERIMENT["suite_tasks"]), len(EXPERIMENT["configurations"]))) parallel.run_jobs(options.jobs, jobs, run_problem) if __name__ == "__main__": main()
(e.g. "ALL", "TEST").''' def parse_options(): parser = OptionParser("usage: %prog [options] [INPUT ...]", description=HELP) parallel.populate_option_parser(parser) parser.add_option( "--relax", help="generate relaxed problem", action="store_true", default=False, dest="relax") options, args = parser.parse_args() options.suite = suites.build_suite(args) return options if __name__ == "__main__": options = parse_options() def run_problem(problem, log_func): log_func("Translating %s..." % problem) success = actions.do_translate( problem, generate_relaxed_problem=options.relax) if not success: return "Translating %s failed, skipping preprocess." % problem log_func("Preprocessing %s..." % problem) success = actions.do_preprocess(problem) if not success: return "Preprocessing %s failed." % problem return None parallel.run_jobs(options.jobs, options.suite, run_problem)
exp[key] = update_dict[key] def read_experiment_file(filename): glob = {} execfile(filename, glob, EXPERIMENT) def main(): options = parse_options() setup_experiment_settings(options) jobs = [(problem, config) for problem in EXPERIMENT["suite_tasks"] for config in EXPERIMENT["configurations"]] print jobs def run_problem((problem, config), log_func): log_func("Solving %s with %s..." % (problem, config)) err_msg = actions.do_search(problem, config, EXPERIMENT["timeout"], EXPERIMENT["memory"], EXPERIMENT["debug"]) return err_msg tools.log("Solving %d problems in %d configurations." % ( len(EXPERIMENT["suite_tasks"]), len(EXPERIMENT["configurations"]))) parallel.run_jobs(options.jobs, jobs, run_problem) if __name__ == "__main__": main()