ENV = LocalEnvironment(processes=6) CONFIGS = [('lmcut', ['--search', 'astar(lmcut())'])] ATTRIBUTES = [ 'coverage', 'expansions', 'initial_h_value', 'cost', 'hstar_to_h' ] #All with timeout #exp = DownwardExperiment(path=EXPPATH, repo=REPO, environment=ENV, limits={'search_time': 100}) #exp.add_suite(suites.suite_all()) #Only lmcut domains without timeout exp = DownwardExperiment(path=EXPPATH, repo=REPO, environment=ENV) exp.add_suite(suites.suite_lmcut_domains()) for nick, config in CONFIGS: exp.add_config(nick, config) # Make a report containing absolute numbers with h*/h values. report = os.path.join(exp.eval_dir, 'report.html') exp.add_report(HstarToHRatio(attributes=ATTRIBUTES), outfile=report) # "Publish" the results with "cat" for demonstration purposes. exp.add_step(Step('publish-report', subprocess.call, ['cat', report])) # Compress the experiment directory. exp.add_step(Step.zip_exp_dir(exp)) # Parse the commandline and show or run experiment steps. exp()
def __init__(self, path=None, repo=None, environment=None, combinations=None, limits=None, attributes=None, derived_properties=None, priority=0, queue=None, processes=2, email=None, cache_dir=CACHE_DIR, **kwargs): if path is None: path = os.path.splitext(os.path.basename(sys.argv[0]))[0] expname = os.path.basename(path) remote_exppath = os.path.join(REMOTE_EXPS, path) local_exppath = os.path.join(LOCAL_EXPS, path) if REMOTE: exppath = remote_exppath repo = repo or REMOTE_REPO environment = environment or MaiaEnvironment(priority=priority, queue=queue, email=email) else: exppath = local_exppath repo = repo or LOCAL_REPO environment = environment or LocalEnvironment(processes=processes) DownwardExperiment.__init__(self, path=exppath, environment=environment, repo=repo, combinations=combinations, limits=limits, cache_dir=cache_dir, **kwargs) self.set_path_to_python(PYTHON) if attributes is None: attributes = ATTRIBUTES # Add report steps abs_report_file = os.path.join(self.eval_dir, '%s-abs.html' % expname) self.add_report(AbsoluteReport(attributes=attributes, colored=True, derived_properties=derived_properties), name='report-abs', outfile=abs_report_file) if REMOTE: # Compress the experiment directory self.add_step(Step.zip_exp_dir(self)) self.add_step(Step('zip-eval-dir', call, ['tar', '-cjf', self.name + '-eval.tar.bz2', self.name + '-eval'], cwd=os.path.dirname(self.path))) self.add_step(Step.remove_exp_dir(self)) self.add_step(Step('remove-eval-dir', shutil.rmtree, self.eval_dir, ignore_errors=True)) if not REMOTE: # Copy the results to local directory self.add_step(Step('scp-eval-dir', call, [ 'scp', '-r', '%s:%s-eval' % (SCP_LOGIN, remote_exppath), '%s-eval' % local_exppath])) # Copy the results to local directory self.add_step(Step('scp-zipped-eval-dir', call, [ 'scp', '-r', '%s:%s-eval.tar.bz2' % (SCP_LOGIN, remote_exppath), '%s-eval.tar.bz2' % local_exppath])) # Copy the zipped experiment directory to local directory self.add_step(Step('scp-exp-dir', call, [ 'scp', '-r', '%s:%s.tar.bz2' % (SCP_LOGIN, remote_exppath), '%s.tar.bz2' % local_exppath])) # Unzip the experiment directory self.add_step(Step.unzip_exp_dir(self)) self.add_step(Step('unzip-eval-dir', call, ['tar', '-xjf', self.name + '-eval.tar.bz2'], cwd=os.path.dirname(self.path)))
CONFIGS = [('lmcut', ['--search', 'astar(lmcut())']) ] ATTRIBUTES = ['coverage', 'expansions','initial_h_value','cost','hstar_to_h','statistics','commualtive_hstar_to_h'] exp = DownwardExperiment(path=EXPPATH, repo=REPO, environment=ENV, limits={'search_time': 300}) exp.add_suite({'freecell'}) for nick, config in CONFIGS: exp.add_config(nick, config) # Make a report containing absolute numbers (this is the most common report). file_name_for_report = 'report_' + nick +'.html' report = os.path.join(exp.eval_dir, file_name_for_report) file_name_for_preprocess = os.path.join(exp.eval_dir, 'preprocess') exp.add_report(HstarToHRatioAndStatistics(nick,file_name_for_preprocess,attributes=ATTRIBUTES), outfile=report) # Plot sub_dir = 'plots_' + nick exp.add_step(Step('report-plot-cat', ProblemPlotReport(), exp.eval_dir, os.path.join(exp.eval_dir, sub_dir))) # "Publish" the results with "cat" for demonstration purposes. exp.add_step(Step('publish-report', subprocess.call, ['cat', report])) # Compress the experiment directory. exp.add_step(Step.zip_exp_dir(exp)) # Parse the commandline and show or run experiment steps. exp()
def __init__(self, path=None, repo=None, environment=None, combinations=None, limits=None, attributes=None, derived_properties=None, priority=0, queue=None, processes=2, email=None, cache_dir=CACHE_DIR, **kwargs): if path is None: path = os.path.splitext(os.path.basename(sys.argv[0]))[0] expname = os.path.basename(path) remote_exppath = os.path.join(REMOTE_EXPS, path) local_exppath = os.path.join(LOCAL_EXPS, path) if REMOTE: exppath = remote_exppath repo = repo or REMOTE_REPO environment = environment or MaiaEnvironment( priority=priority, queue=queue, email=email) else: exppath = local_exppath repo = repo or LOCAL_REPO environment = environment or LocalEnvironment(processes=processes) DownwardExperiment.__init__(self, path=exppath, environment=environment, repo=repo, combinations=combinations, limits=limits, cache_dir=cache_dir, **kwargs) self.set_path_to_python(PYTHON) if attributes is None: attributes = ATTRIBUTES # Add report steps abs_report_file = os.path.join(self.eval_dir, '%s-abs.html' % expname) self.add_report(AbsoluteReport(attributes=attributes, colored=True, derived_properties=derived_properties), name='report-abs', outfile=abs_report_file) if REMOTE: # Compress the experiment directory self.add_step(Step.zip_exp_dir(self)) self.add_step( Step('zip-eval-dir', call, [ 'tar', '-cjf', self.name + '-eval.tar.bz2', self.name + '-eval' ], cwd=os.path.dirname(self.path))) self.add_step(Step.remove_exp_dir(self)) self.add_step( Step('remove-eval-dir', shutil.rmtree, self.eval_dir, ignore_errors=True)) if not REMOTE: # Copy the results to local directory self.add_step( Step('scp-eval-dir', call, [ 'scp', '-r', '%s:%s-eval' % (SCP_LOGIN, remote_exppath), '%s-eval' % local_exppath ])) # Copy the results to local directory self.add_step( Step('scp-zipped-eval-dir', call, [ 'scp', '-r', '%s:%s-eval.tar.bz2' % (SCP_LOGIN, remote_exppath), '%s-eval.tar.bz2' % local_exppath ])) # Copy the zipped experiment directory to local directory self.add_step( Step('scp-exp-dir', call, [ 'scp', '-r', '%s:%s.tar.bz2' % (SCP_LOGIN, remote_exppath), '%s.tar.bz2' % local_exppath ])) # Unzip the experiment directory self.add_step(Step.unzip_exp_dir(self)) self.add_step( Step('unzip-eval-dir', call, ['tar', '-xjf', self.name + '-eval.tar.bz2'], cwd=os.path.dirname(self.path)))