-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpddl_domain_example.pddl
353 lines (311 loc) · 7.92 KB
/
pddl_domain_example.pddl
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
;Header and description
(define (domain polycraft_generated)
;remove requirements that are not needed
(:requirements :typing :strips :fluents :negative-preconditions :equality)
(:types ;todo: enumerate types and their hierarchy here, e.g. car truck bus - vehicle
pickaxe_breakable - breakable
hand_breakable - pickaxe_breakable
breakable - placeable
placeable - physobj
physobj - physical
actor - physobj
trader - actor
pogoist - actor
agent - actor
oak_log - log
distance - var
bedrock - placeable
door - placeable
safe - placeable
plastic_chest - placeable
tree_tap - placeable
oak_log - hand_breakable
diamond_ore - pickaxe_breakable
iron_pickaxe - physobj
crafting_table - hand_breakable
block_of_platinum - pickaxe_breakable
block_of_titanium - placeable
sapling - placeable
planks - physobj
stick - physobj
diamond - physobj
block_of_diamond - physobj
rubber - physobj
pogo_stick - physobj
blue_key - physobj
)
(:constants
air - physobj
one - distance
two - distance
rubber - physobj
blue_key - physobj
)
(:predicates ;todo: define predicates here
(holding ?v0 - physobj)
(floating ?v0 - physobj)
(facing ?v0 - physobj ?d - distance)
(next_to ?v0 - physobj ?v1 - physobj)
)
(:functions ;todo: define numeric functions here
(world ?v0 - physobj)
(inventory ?v0 - physobj)
(container ?v0 - physobj ?v1 - physobj)
)
; define actions here
(:action approach
:parameters (?physobj01 - physobj ?physobj02 - physobj )
:precondition (and
(>= ( world ?physobj02) 1)
(facing ?physobj01 one)
)
:effect (and
(facing ?physobj02 one)
(not (facing ?physobj01 one))
)
)
(:action approach_actor
:parameters (?physobj01 - physobj ?physobj02 - actor )
:precondition (and
(facing ?physobj01 one)
)
:effect (and
(facing ?physobj02 one)
(not (facing ?physobj01 one))
)
)
(:action break
:parameters (?physobj - hand_breakable)
:precondition (and
(facing ?physobj one)
(not (floating ?physobj))
)
:effect (and
(facing air one)
(not (facing ?physobj one))
(increase ( inventory ?physobj) 1)
(increase ( world air) 1)
(decrease ( world ?physobj) 1)
)
)
(:action break_holding_iron_pickaxe
:parameters (?physobj - pickaxe_breakable ?iron_pickaxe - iron_pickaxe)
:precondition (and
(facing ?physobj one)
(not (floating ?physobj))
(holding ?iron_pickaxe)
)
:effect (and
(facing air one)
(not (facing ?physobj one))
(increase ( inventory ?physobj) 1)
(increase ( world air) 1)
(decrease ( world ?physobj) 1)
)
)
(:action break_diamond_ore
:parameters (?iron_pickaxe - iron_pickaxe)
:precondition (and
(facing diamond_ore one)
(not (floating diamond_ore))
(holding ?iron_pickaxe)
)
:effect (and
(facing air one)
(not (facing diamond_ore one))
(increase ( inventory diamond) 9)
(increase ( world air) 1)
(decrease ( world diamond_ore) 1)
)
)
(:action select
:parameters (?prev_holding - physobj ?obj_to_select - physobj)
:precondition (and
(>= ( inventory ?obj_to_select) 1)
(holding ?prev_holding)
(not (= ?obj_to_select air))
)
:effect (and
(holding ?obj_to_select)
(not (holding ?prev_holding))
)
)
(:action deselect_item
:parameters (?physobj01 - physobj)
:precondition (and
(holding ?physobj01)
(not (holding air))
)
:effect (and
(not (holding ?physobj01))
(holding air)
)
)
(:action place
:parameters (?physobj01 - placeable)
:precondition (and
(facing air one)
(holding ?physobj01)
)
:effect (and
(facing ?physobj01 one)
(not (facing air one))
(increase ( world ?physobj01) 1)
(decrease ( inventory ?physobj01) 1)
)
)
(:action collect_from_tree_tap
:parameters (?actor - actor ?log - log)
:precondition (and
(holding tree_tap)
(facing ?log one)
)
:effect (and
(increase ( inventory rubber) 1)
)
)
;; not working
(:action collect_from_safe
:parameters (?actor - actor ?safe - safe)
:precondition (and
(facing ?safe one)
(holding blue_key)
(>= (container ?safe diamond) 18)
)
:effect (and
(decrease (container ?safe diamond) 18)
(increase (inventory diamond) 18)
)
)
;; not working
(:action collect_from_chest
:parameters (?actor - actor ?chest - plastic_chest)
:precondition (and
(facing ?chest one)
(>= (container ?chest blue_key) 1)
)
:effect (and
(increase (inventory blue_key) 1)
(decrease (container ?chest blue_key) 1)
)
)
; TODO collect from safe
; (:action collect_from_safe
; :parameters (?actor - actor ?safe - safe)
; :precondition (and
; (facing_obj ?actor ?safe one)
; (holding key)
; (= (container ?safe diamond) 18)
; )
; :effect (and
; (decrease (container ?safe diamond) 18)
; (increase (inventory ?actor diamond) 18)
; )
; )
; additional actions, including craft and trade
(:action craft_stick
:parameters ()
:precondition (and
(>= ( inventory planks) 2)
)
:effect (and
(decrease ( inventory planks) 2)
(increase ( inventory stick) 4)
)
)
(:action craft_planks
:parameters ()
:precondition (and
(>= ( inventory oak_log) 1)
)
:effect (and
(decrease ( inventory oak_log) 1)
(increase ( inventory planks) 4)
)
)
(:action craft_block_of_diamond
:parameters ()
:precondition (and
(facing crafting_table one)
(>= ( inventory diamond) 9)
)
:effect (and
(decrease ( inventory diamond) 9)
(increase ( inventory block_of_diamond) 1)
)
)
(:action craft_tree_tap
:parameters ()
:precondition (and
(facing crafting_table one)
(>= ( inventory planks) 5)
(>= ( inventory stick) 1)
)
:effect (and
(decrease ( inventory planks) 5)
(decrease ( inventory stick) 1)
(increase ( inventory tree_tap) 1)
)
)
(:action craft_pogo_stick
:parameters ()
:precondition (and
(facing crafting_table one)
(>= ( inventory stick) 2)
(>= ( inventory block_of_titanium) 2)
(>= ( inventory block_of_diamond) 2)
(>= ( inventory rubber) 1)
)
:effect (and
(decrease ( inventory stick) 2)
(decrease ( inventory block_of_titanium) 2)
(decrease ( inventory block_of_diamond) 2)
(decrease ( inventory rubber) 1)
(increase ( inventory pogo_stick) 1)
)
)
(:action trade_block_of_titanium_1
:parameters ()
:precondition (and
(facing entity_103 one)
(>= ( inventory block_of_platinum) 1)
)
:effect (and
(decrease ( inventory block_of_platinum) 1)
(increase ( inventory block_of_titanium) 1)
)
)
(:action trade_block_of_platinum_1
:parameters ()
:precondition (and
(facing entity_103 one)
(>= ( inventory diamond) 18)
)
:effect (and
(decrease ( inventory diamond) 18)
(increase ( inventory block_of_platinum) 1)
)
)
(:action trade_diamond_1
:parameters ()
:precondition (and
(facing entity_104 one)
(>= ( inventory block_of_platinum) 2)
)
:effect (and
(decrease ( inventory block_of_platinum) 2)
(increase ( inventory diamond) 9)
)
)
(:action trade_block_of_titanium_2
:parameters ()
:precondition (and
(facing entity_104 one)
(>= ( inventory oak_log) 10)
)
:effect (and
(decrease ( inventory oak_log) 10)
(increase ( inventory block_of_titanium) 2)
)
)
)