for result in results.get_ids(): res = results[result] for tog in toggles: if '' == res.single_args[tog]: file_output += '1,' else: file_output += '0,' file_output += "%s,%d,%f\n" % _get_file_size_time_bdg(res) write_file(domain + '-results.csv', file_output) ###################################### opts, flags = get_opts() did_something = False if '-domain' in opts: all_domains = [opts['-domain']] if 'size_time' in flags: did_something = True if not os.path.isdir('size_time_results'): os.system('mkdir size_time_results') for dom in all_domains: test_size_time(dom) os.system('mv results-* size_time_results')
import os from krrt.utils import fileio, run_experiment, get_opts, get_value, write_file domain = get_opts()[0]['-domain'] problems = fileio.read_file("%s/pmap" % domain) domprobs = [ "../%s/domain.pddl ../%s/%s OUT --jic-limit 10" % (domain, domain, prob) for prob in problems ] results = run_experiment( base_directory=".", base_command='./../../src/plan-prp', single_arguments={'domprob': domprobs}, time_limit=1800, # 15minute time limit (900 seconds) memory_limit=1000, # 1gig memory limit (1000 megs) results_dir="%s/results" % domain, progress_file=None, # Print the progress to stdout processors=6, # You've got 8 cores, right? sandbox='fd_out', clean_sandbox=False) good_results = results.filter(lambda result: not result.timed_out) good_results = [good_results[i] for i in good_results.get_ids()] print "Coverage: %d / %d" % (len(good_results), len(domprobs)) try: data = ['runtime(s),size(nodes)'] + [ "%f,%d" %
f, (ax1) = pylab.subplots(1) SYMBOLS = ['s', 'x', 'o', '^', '>', 'v', '<', 'd', 'p', 'h', '8'] COLOURS = ['b','g','k','m'] LINES = ['-', '--', '-.', ':'] handle = ax1.plot(xs, data, c='b', ls='-') ax1.set_title(title) if logplot: ax1.set_yscale('log') pylab.show() if '-csv' in get_opts()[0]: data = [line.split(',') for line in read_file(get_opts()[0]['-csv'])[1:]] times = [float(i[0]) for i in data] sizes = [float(i[1]) for i in data] print "Mean time: %f" % (sum(times) / len(times)) print "Mean size: %f" % (sum(sizes) / len(sizes)) elif '-size' in get_opts()[0]: dom = get_opts()[0]['-size'] fname = "%s.csv" % dom data = [line.split(',') for line in read_file(fname)[1:]] times = sorted([float(i[0]) for i in data]) sizes = sorted([float(i[1]) for i in data]) xs = [i+1 for i in range(len(data))]
if disable_x_tics: ax.xaxis.set_major_formatter(pylab.NullFormatter()) pylab.show() def create_time_profile(times): x = sorted(times) y = [i + 1 for i in range(len(times))] return (x, y) if __name__ == '__main__': from krrt.utils import get_opts import os myargs, flags = get_opts() if '-csv' not in myargs: print("Error: Must include a path to the csv file:") print(USAGE_STRING) os._exit(1) title = None if '-title' in myargs: title = myargs['-title'] xlabel = "" if '-xlabel' in myargs: xlabel = myargs['-xlabel'] ylabel = ""
from krrt.utils import get_opts, write_file (options, _) = get_opts() prob = options['-prob'] peeps = int(options['-peeps']) out = """(define (domain zenotravel) (:requirements :typing :non-deterministic) (:types aircraft person city flevel - object)\n""" out += " (:constants %s - person)\n" % (' '.join( ["p%d" % i for i in range(peeps)])) out += """ (:predicates (at-person ?p - person ?c - city) (at-aircraft ?a - aircraft ?c - city) (boarding ?p - person ?a - aircraft) (not-boarding ?p - person) (in ?p - person ?a - aircraft) (debarking ?p - person ?a - aircraft) (not-debarking ?p - person) (fuel-level ?a - aircraft ?l - flevel) (next ?l1 ?l2 - flevel) (flying ?a - aircraft ?c - city) (zooming ?a - aircraft ?c - city) (refueling ?a - aircraft) (not-refueling ?a - aircraft) ) (:action start-boarding :parameters (?p - person ?a - aircraft ?c - city) :precondition (and (at-person ?p ?c) (at-aircraft ?a ?c)) :effect (and (not (at-person ?p ?c)) (not (not-boarding ?p)) (boarding ?p ?a))