-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdepotsDomain.py
More file actions
70 lines (56 loc) · 2.9 KB
/
Copy pathdepotsDomain.py
File metadata and controls
70 lines (56 loc) · 2.9 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
from Action import Action
def getActions():
actions = []
# locations = ['A','B','C']
# crates = ['c1','c2','c3']
# trucks = ['t1','t2']
# hoists = ['h1','h2','h3']
# pallets = ['p']
locations = ['A','B','C']
crates = ['c1']
trucks = ['t1']
hoists = ['h1','h2','h3']
pallets = ['p']
for truck in trucks:
for l1 in locations:
for l2 in locations:
if l1 != l2:
move = Action(name=f'Move({truck}, {l1}, {l2})',
positive_preconditions=[f'At({truck}, {l1})'],
negative_preconditions=[],
add_list=[f'At({truck}, {l2})'],
delete_list=[f'At({truck}, {l1})'])
actions.append(move)
for hoist in hoists:
for crate in crates:
for pallet in pallets:
for location in locations:
lift =Action(name=f'Lifting({hoist}, {crate}, {pallet}, {location})',
positive_preconditions=[f'At({hoist}, {location})', f'At({crate}, {location})', f'On({crate}, {pallet})', f'Available({hoist})'],
negative_preconditions=[],
add_list=[f'Lifting({hoist}, {crate})'],
delete_list=[f'On({crate}, {pallet})', f'Available({hoist})', f'At({crate}, {location})'])
actions.append(lift)
drop = Action(name=f'Drop({hoist}, {crate}, {pallet}, {location})',
positive_preconditions=[f'Lifting({hoist}, {crate})', f'At({hoist}, {location})'],
negative_preconditions=[],
add_list=[f'On({crate}, {pallet})', f'Available({hoist})', f'At({crate}, {location})'],
delete_list=[f'Lifting({hoist}, {crate})'])
actions.append(drop)
for truck in trucks:
for hoist in hoists:
for crate in crates:
for location in locations:
load = Action(name=f'Load({hoist}, {crate}, {truck}, {location})',
positive_preconditions=[f'At({hoist}, {location})', f'At({truck}, {location})', f'Lifting({hoist}, {crate})'],
negative_preconditions=[],
add_list=[f'In({crate}, {truck})', f'Available({hoist})'],
delete_list=[f'Lifting({hoist}, {crate})'])
actions.append(load)
unload = Action(name=f'Unload({hoist}, {crate}, {truck}, {location})',
positive_preconditions=[f'In({crate}, {truck})', f'Available({hoist})', f'At({truck}, {location})', f'At({hoist}, {location})'],
negative_preconditions=[],
add_list=[f'Lifting({hoist}, {crate})'],
delete_list=[f'In({crate}, {truck})', f'Available({hoist})'])
actions.append(unload)
return actions