from runtests import __problems__, maxtask from pddl.parser import Parser import os def problemInfo(domFile): parser = Parser(domFile) domain = parser.parse_domain() return len(domain.predicates), len(domain.actions) def avg(list): return sorted(list)[len(list)//2] for problemtup in __problems__: problem = problemtup[0] if os.path.exists("../benchmarks/{}/domain.pddl".format(problem)): domFile = "../benchmarks/{}/domain.pddl".format(problem) print(problemInfo(domFile)) else: all = [] for task in range(maxtask(problem)): domFile = "../benchmarks/{}/domain{}.pddl".format(problem,str(task+1).zfill(2)) all.append(problemInfo(domFile)) print((avg([a for a,b in all]),avg([b for a,b in all])))
def totaltasks(files): from runtests import __problems__, maxtask return sum(maxtask(problem[0]) for problem in __problems__)