6
6
from logic import FolKB
7
7
8
8
9
- class PDLL :
9
+ class PDDL :
10
10
"""
11
- PDLL used to define a search problem.
11
+ Planning Domain Definition Language (PDDL) used to define a search problem.
12
12
It stores states in a knowledge base consisting of first order logic statements.
13
13
The conjunction of these logical statements completely defines a state.
14
14
"""
@@ -140,7 +140,7 @@ def goal_test(kb):
140
140
effect_rem = [expr ("At(p, f)" )]
141
141
fly = Action (expr ("Fly(p, f, to)" ), [precond_pos , precond_neg ], [effect_add , effect_rem ])
142
142
143
- return PDLL (init , [load , unload , fly ], goal_test )
143
+ return PDDL (init , [load , unload , fly ], goal_test )
144
144
145
145
146
146
def spare_tire ():
@@ -181,7 +181,7 @@ def goal_test(kb):
181
181
leave_overnight = Action (expr ("LeaveOvernight" ), [precond_pos , precond_neg ],
182
182
[effect_add , effect_rem ])
183
183
184
- return PDLL (init , [remove , put_on , leave_overnight ], goal_test )
184
+ return PDDL (init , [remove , put_on , leave_overnight ], goal_test )
185
185
186
186
187
187
def three_block_tower ():
@@ -219,7 +219,7 @@ def goal_test(kb):
219
219
moveToTable = Action (expr ('MoveToTable(b, x)' ), [precond_pos , precond_neg ],
220
220
[effect_add , effect_rem ])
221
221
222
- return PDLL (init , [move , moveToTable ], goal_test )
222
+ return PDDL (init , [move , moveToTable ], goal_test )
223
223
224
224
225
225
def have_cake_and_eat_cake_too ():
@@ -248,7 +248,7 @@ def goal_test(kb):
248
248
effect_rem = []
249
249
bake_cake = Action (expr ('Bake(Cake)' ), [precond_pos , precond_neg ], [effect_add , effect_rem ])
250
250
251
- return PDLL (init , [eat_cake , bake_cake ], goal_test )
251
+ return PDDL (init , [eat_cake , bake_cake ], goal_test )
252
252
253
253
254
254
class Level ():
@@ -408,17 +408,17 @@ class Graph:
408
408
Used in graph planning algorithm to extract a solution
409
409
"""
410
410
411
- def __init__ (self , pdll , negkb ):
412
- self .pdll = pdll
413
- self .levels = [Level (pdll .kb , negkb )]
414
- self .objects = set (arg for clause in pdll .kb .clauses + negkb .clauses for arg in clause .args )
411
+ def __init__ (self , pddl , negkb ):
412
+ self .pddl = pddl
413
+ self .levels = [Level (pddl .kb , negkb )]
414
+ self .objects = set (arg for clause in pddl .kb .clauses + negkb .clauses for arg in clause .args )
415
415
416
416
def __call__ (self ):
417
417
self .expand_graph ()
418
418
419
419
def expand_graph (self ):
420
420
last_level = self .levels [- 1 ]
421
- last_level (self .pdll .actions , self .objects )
421
+ last_level (self .pddl .actions , self .objects )
422
422
self .levels .append (last_level .perform_actions ())
423
423
424
424
def non_mutex_goals (self , goals , index ):
@@ -436,8 +436,8 @@ class GraphPlan:
436
436
Returns solution for the planning problem
437
437
"""
438
438
439
- def __init__ (self , pdll , negkb ):
440
- self .graph = Graph (pdll , negkb )
439
+ def __init__ (self , pddl , negkb ):
440
+ self .graph = Graph (pddl , negkb )
441
441
self .nogoods = []
442
442
self .solution = []
443
443
@@ -524,9 +524,9 @@ def goal_test(kb, goals):
524
524
525
525
526
526
def spare_tire_graphplan ():
527
- pdll = spare_tire ()
527
+ pddl = spare_tire ()
528
528
negkb = FolKB ([expr ('At(Flat, Trunk)' )])
529
- graphplan = GraphPlan (pdll , negkb )
529
+ graphplan = GraphPlan (pddl , negkb )
530
530
531
531
# Not sure
532
532
goals_pos = [expr ('At(Spare, Axle)' ), expr ('At(Flat, Ground)' )]
@@ -573,4 +573,4 @@ def goal_test(kb):
573
573
effect_rem = [expr ("At(actor, loc)" )]
574
574
go = Action (expr ("Go(actor, to)" ), [precond_pos , precond_neg ], [effect_add , effect_rem ])
575
575
576
- return PDLL (init , [hit , go ], goal_test )
576
+ return PDDL (init , [hit , go ], goal_test )
0 commit comments