def execute( self ) :
		if not self.convert_to_integers :
			cmd_string = './pr2plan -d %s -i %s -o %s -P'%(self.domain, self.problem, self.obs_stream)
		else :
			cmd_string = './pr2plan -d %s -i %s -o %s -P -Z %s'%(self.domain, self.problem, self.obs_stream, self.factor)
		self.log = benchmark.Log( '%s_%s_%s_transcription.log'%(self.domain, self.problem, self.obs_stream) )
		self.signal, self.time = benchmark.run( cmd_string, self.max_time, self.max_mem, self.log )
Ejemplo n.º 2
0
 def execute(self):
     cmd_string = './pr2plan -d %s -i %s -o %s' % (
         self.domain, self.problem, self.obs_stream)
     self.log = benchmark.Log('%s_%s_%s_transcription.log' %
                              (self.domain, self.problem, self.obs_stream))
     self.signal, self.time = benchmark.run(cmd_string, self.max_time,
                                            self.max_mem, self.log)
Ejemplo n.º 3
0
def run_task(benchmark, command, domain, instance, folder, timeout):
    import benchmark
    import os
    import json

    current_dir = os.getcwd()
    os.chdir(folder)
    log = 'trace.log'
    rv, time = benchmark.run(command, timeout, 4096, benchmark.Log(log))
    command_info = {}
    command_info['exit_code'] = rv
    command_info['wall_time'] = time

    if rv == 0:
        json_search_data = 'search.json'
        if os.path.exists(json_search_data):
            with open(json_search_data) as input:
                try:
                    s = input.read()
                    data = json.loads(s)
                except ValueError as e:
                    print(e)
                    print("Read from file:")
                    print(s)
                    os.chdir(current_dir)
                    return
                for k, v in data.items():
                    command_info[k] = v
        else:
            print("No json data payload found!")

    os.chdir(current_dir)
    data_folder = 'data'
    data_folder = os.path.join(data_folder, domain)
    if not os.path.exists(data_folder):
        os.makedirs(data_folder)

    info_filename = os.path.join(data_folder, '{0}.json'.format(instance))
    if not os.path.exists(info_filename):
        info = {}
        info['domain'] = domain
        info['instance'] = instance
        info['planners_data'] = {}
    else:
        with open(info_filename) as instream:
            info = json.loads(instream.read())
    info['planners_data'][command] = command_info

    with open(info_filename, 'w') as outstream:
        payload = json.dumps(info,
                             separators=(',', ':'),
                             indent=4,
                             sort_keys=True)
        outstream.write(payload)

    return payload
Ejemplo n.º 4
0
 def execute(self):
     if self.upper_bound is None:
         ub_string = ''
     else:
         ub_string = '-ub %s' % self.upper_bound
     cmd_string = './hsp_f -strict -dba-semantics -rm -cost -rAH -use-lse -bfs %s -v 0 -ipc %s %s > %s.soln' % (
         ub_string, self.domain, self.problem, self.noext_problem)
     self.log = benchmark.Log('%s.log' % self.noext_problem)
     self.signal, self.time = benchmark.run(cmd_string, self.max_time,
                                            self.max_mem, self.log)
     self.gather_data()
Ejemplo n.º 5
0
 def execute(self):
     if LAMA.greedy:
         cmd_string = './plan-greedy %s %s %s' % (self.domain, self.problem,
                                                  self.result)
     else:
         cmd_string = './plan %s %s %s' % (self.domain, self.problem,
                                           self.result)
     self.log = benchmark.Log(self.log_file)
     self.signal, self.time = benchmark.run(cmd_string, self.max_time,
                                            self.max_mem, self.log)
     self.gather_data()
Ejemplo n.º 6
0
 def execute(self):
     if LAMA.greedy:
         #cmd_string = '/home/mk/Planning/fastdownwardplanner/fast-downward.py  --alias seq-sat-lama-2011 %s %s '%( self.domain, self.problem)
         cmd_string = '/home/mk/Planning/fastdownwardplanner/fast-downward.py  --alias lama-first %s %s ' % (
             self.domain, self.problem)
     else:
         #cmd_string = './plan %s %s %s'%( self.domain, self.problem, self.result)
         cmd_string = '/home/mk/Planning/fastdownwardplanner/fast-downward.py  --alias lama-first %s %s ' % (
             self.domain, self.problem
         )  #Michael. I could put the normal lama here?
     self.log = benchmark.Log(self.log_file)
     self.signal, self.time = benchmark.run(cmd_string, self.max_time,
                                            self.max_mem, self.log)
     self.gather_data()
Ejemplo n.º 7
0
 def execute(self):
     if self.simple:
         cmd_string = './subopt_PR -d %s -i %s -I' % (self.domain,
                                                      self.problem)
     else:
         if self.bfs:
             cmd_string = './subopt_PR -d %s -i %s -B' % (self.domain,
                                                          self.problem)
         else:
             cmd_string = './subopt_PR -d %s -i %s' % (self.domain,
                                                       self.problem)
     self.log = benchmark.Log('%s.log' % self.noext_problem)
     self.signal, self.time = benchmark.run(cmd_string, self.max_time,
                                            self.max_mem, self.log)
     self.gather_data()
Ejemplo n.º 8
0
def main() :
	
	usr_opts = PlannerOptions( sys.argv[1:] )
	
	command = '%s --domain %s --problem %s --time %s'%( usr_opts.planner, usr_opts.domain, usr_opts.problem, usr_opts.max_time )	
	log_filename = [ os.path.basename(usr_opts.domain).replace('.pddl',''),
			 '_',  os.path.basename( usr_opts.problem).replace('.pddl',''),
			 '_', usr_opts.planner.split('/')[-2], '.log' ]

	print log_filename
	
	log = benchmark.Log( ''.join(log_filename) )
	rv, time = benchmark.run( command, usr_opts.max_time, usr_opts.max_memory, log )

	print >> sys.stdout, "Exit Code:", rv, "Time:", time	
Ejemplo n.º 9
0
def main():

    commands = [
        ('./siw.py ~/Sandboxes/Fast-Downward/benchmarks/blocks/domain.pddl %(instance)s plan.ipc',
         'siw-'),
    ]

    files = glob.glob(
        '/home/bowman/Sandboxes/Fast-Downward/benchmarks/blocks/probBLOCKS-*.pddl'
    )
    files.sort()
    os.system('rm -rf *.res')

    for command, prefix in commands:
        res_file = '%sresult.csv' % prefix
        if os.path.exists(res_file):
            os.system('rm -rf %s' % res_file)
        results = []
        for instance in files:
            output = prefix + os.path.split(instance)[-1].replace(
                'pddl', 'res')
            instance_command = command % locals()

            log = benchmark.Log(output)
            signal, time = benchmark.run(instance_command, 1800, 2048, log)
            print >> sys.stdout, "%s, %s, %s" % (instance, signal, time)
            expanded = None
            cost = None
            with open(output) as log_output:
                for line in log_output:
                    if 'expanded during' in line:
                        exp_tok = line.split(':')[-1]
                        expanded = exp_tok.strip()
                        continue
                    if 'Plan found with cost' in line:
                        cost_tok = line.split(':')[-1]
                        cost = cost_tok.strip()
                        continue
            results.append([
                os.path.split(instance)[-1].replace('.pddl',
                                                    '').replace('-', ' '),
                expanded, cost
            ])
        results.sort()
        with open(res_file, 'w') as output:
            for instance, exp, cost in results:
                print >> output, "%s,%s,%s" % (instance, exp, cost)
def run_instance(folder, command, agent, rom_path, i):
    res_filename = os.path.join(folder, 'episode.%d' % (i + 1))
    log_filename = os.path.join(folder, 'fulllog.%d' % (i + 1))

    log = benchmark.Log('%s' % (log_filename))
    benchmark.run(command, 0, 4096, log)
    if not os.path.exists('episode.1'):
        with open(res_filename, 'w') as output:
            print >> output, "Agent crashed"

    else:
        os.system('mv episode.1 %s' % res_filename)

    if agent == 'random': return
    trace_filename = 'episode.%d.trace' % (i + 1)
    trace_filename = os.path.join(folder, trace_filename)
    os.system('mv %(agent)s.search-agent.trace %(trace_filename)s' % locals())
Ejemplo n.º 11
0
def main():
    opt = nff_options.Program_Options(sys.argv[1:])
    opt.print_options()

    dom_name_clean = os.path.basename(opt.domain).replace('.pddl', '')
    inst_name_clean = os.path.basename(opt.instance).replace('.pddl', '')

    name = '%s_%s' % (dom_name_clean, inst_name_clean)

    log = benchmark.Log('%s.log' % name)
    exec_name = 'c3'

    cmd = './%s -d %s -i %s' % (exec_name, opt.domain, opt.instance)
    #if opt.use_h1 : cmd += ' -1'
    #if opt.use_hcl : cmd += ' -2'
    #if opt.pw_each_layer : cmd += ' -P'
    #if opt.do_bnb : cmd += ' -B'
    #if opt.constrain_h1 : cmd += ' -C'
    #if opt.joint_persistency : cmd += ' -J'
    #if opt.keep_based_ranking : cmd += ' -K'
    #if opt.reachable : cmd += ' -R'

    #cmd += ' -b %d'%opt.branch_opt

    signal, time = benchmark.run(cmd, opt.max_time, opt.max_memory, log)

    res_info = [dom_name_clean, inst_name_clean, str(signal), str(time)]

    if os.path.exists('execution.stats'):
        instream = open('execution.stats')
        for line in instream:
            line = line.strip()
            toks = line.split('=')
            res_info.append(toks[1])
        instream.close()

    outstream = open('%s.result' % name, 'w')

    print >> outstream, ",".join(res_info)

    outstream.close()
Ejemplo n.º 12
0
 def execute(self):
     if LAMA.greedy:
         #cmd_string = '/home/mk/Planning/fastdownwardplanner/fast-downward.py  --alias seq-sat-lama-2011 %s %s '%( self.domain, self.problem)
         #cmd_string = '/home/mk/Planning/fastdownwardplanner/fast-downward.py  --alias lama-first %s %s '%( self.domain, self.problem)
         #cmd_string = '/home/mk/PycharmProjects/pic-to-plan-v2-git/pic_to_plan_v2/fd-0/fast-downward.py  --alias seq-sat-lama-2011 %s %s '%( self.domain, self.problem)
         cmd_string = os.path.join(
             '..', 'downward', 'fast-downward.py'
         ) + ' %s %s --evaluator "hff=ff()" --evaluator "hcea=cea()" --search "lazy_greedy([hff, hcea], preferred=[hff, hcea])"' % (
             self.domain, self.problem)
     else:
         #cmd_string = './plan %s %s %s'%( self.domain, self.problem, self.result)
         #cmd_string = '/home/mk/PycharmProjects/pic-to-plan-v2-git/pic_to_plan_v2/fd-0/fast-downward.py  --alias seq-sat-lama-2011 %s %s '%( self.domain, self.problem)  #Michael. I could put the normal lama here?
         #cmd_string = '/home/mk/PycharmProjects/pic-to-plan-v2-git/pic_to_plan_v2/fd-0/fast-downward.py %s %s --evaluator "hff=ff()" --evaluator "hcea=cea()" --search "lazy_greedy([hff, hcea], preferred=[hff, hcea])"'%( self.domain, self.problem)
         cmd_string = os.path.join(
             '..', 'downward', 'fast-downward.py'
         ) + ' %s %s --evaluator "hff=ff()" --evaluator "hcea=cea()" --search "lazy_greedy([hff, hcea], preferred=[hff, hcea])"' % (
             self.domain, self.problem)
     self.log = benchmark.Log(self.log_file)
     self.signal, self.time = benchmark.run(cmd_string, self.max_time,
                                            self.max_mem, self.log)
     self.gather_data()
Ejemplo n.º 13
0
 def execute(self):
     cmd_string = './ff -O -E -o %s -f %s' % (self.domain, self.problem)
     self.log = benchmark.Log(self.log_file)
     self.signal, self.time = benchmark.run(cmd_string, self.max_time,
                                            self.max_mem, self.log)
     self.gather_data()