-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplanner.py
More file actions
56 lines (39 loc) · 1.11 KB
/
Copy pathplanner.py
File metadata and controls
56 lines (39 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import os, sys, time
from parser import parse
def cleanup():
os.system('rm -f domain.pddl')
os.system('rm -f problem.pddl')
#os.system('rm -f output.txt')
#os.system('rm -f output.txt.err')
os.system('rm -f human_policy.out')
os.system('rm -f policy.out')
os.system('rm -f graph.dot')
os.system('rm -f action.map')
os.system('rm -f unhandled.states')
os.system('./cleanup')
def solve(fname):
print
t_start = time.time()
print "Parsing problem...",
sys.stdout.flush()
problem = parse(fname)
print "done!"
print "Compiling problem..."
sys.stdout.flush()
problem.compile()
print "done!"
print "\nSolving problem...",
sys.stdout.flush()
problem.solve()
print "done!"
print "\nTime: %f s" % (time.time() - t_start)
print
problem.output_solution()
print
if __name__ == '__main__':
if len(sys.argv) < 2:
print "\nUsage: python planner.py <teamwork problem file> [--keep-files]\n"
sys.exit(1)
solve(sys.argv[1])
if len(sys.argv) < 3 or '--keep-files' != sys.argv[2]:
cleanup()