@@ -173,9 +173,9 @@ class Action:
173
173
Precondition and effect are both lists with positive and negative literals.
174
174
Negative preconditions and effects are defined by adding a 'Not' before the name of the clause
175
175
Example:
176
- precond = [expr(" Human(person)" ), expr(" Hungry(Person)" ), expr(" NotEaten(food)" )]
177
- effect = [expr(" Eaten(food)" ), expr(" Hungry(person)" )]
178
- eat = Action(expr(" Eat(person, food)" ), precond, effect)
176
+ precond = [expr(' Human(person)' ), expr(' Hungry(Person)' ), expr(' NotEaten(food)' )]
177
+ effect = [expr(' Eaten(food)' ), expr(' Hungry(person)' )]
178
+ eat = Action(expr(' Eat(person, food)' ), precond, effect)
179
179
"""
180
180
181
181
def __init__ (self , action , precond , effect , domain = None ):
@@ -1371,7 +1371,12 @@ def execute(self, display=True):
1371
1371
self .constraints = self .protect ((act0 , G , act1 ), action , self .constraints )
1372
1372
1373
1373
if step > 200 :
1374
- print ("Couldn't find a solution" )
1374
+ print ('Couldn'
1375
+ t
1376
+ find
1377
+ a
1378
+ solution
1379
+ ')
1375
1380
return None , None
1376
1381
1377
1382
if display :
@@ -1450,12 +1455,18 @@ def do_action(self, job_order, available_resources, kb, args):
1450
1455
if not self .has_consumable_resource (available_resources ):
1451
1456
raise Exception ('Not enough consumable resources to execute {}' .format (self .name ))
1452
1457
if not self .inorder (job_order ):
1453
- raise Exception ("Can't execute {} - execute prerequisite actions first" .
1454
- format (self .name ))
1455
- kb = super ().act (kb , args ) # update knowledge base
1456
- for resource in self .consumes : # remove consumed resources
1457
- available_resources [resource ] -= self .consumes [resource ]
1458
- self .completed = True # set the task status to complete
1458
+ raise Exception ('Can'
1459
+ t
1460
+ execute
1461
+ {} - execute
1462
+ prerequisite
1463
+ actions
1464
+ first
1465
+ '.format (self .name ))
1466
+ kb = super ().act (kb , args ) # update knowledge base
1467
+ for resource in self .consumes : # remove consumed resources
1468
+ available_resources [resource ] -= self .consumes [resource ]
1469
+ self .completed = True # set the task status to complete
1459
1470
return kb
1460
1471
1461
1472
def has_consumable_resource (self , available_resources ):
0 commit comments