Esempio n. 1
0
 def pddl(self, costs):
     s = '(:action ' + self.name + '\n'
     s += '\t:parameters (' + ' '.join(param.typed_pddl()
                                       for param in self.parameters) + ')\n'
     s += '\t:precondition ' + self.condition.pddl() + '\n'
     augmented_effect = self.effect
     if costs and self.cost is not None and not self.cost_included:
         augmented_effect = And(augmented_effect, Cost(self.cost))
     s += '\t:effect ' + augmented_effect.pddl()
     return s + ')'
Esempio n. 2
0
 def pddl(self, costs, durative=False):
     if durative:
         return self.durative_pddl()
     parameters_pddl = ' '.join(param.typed_pddl()
                                for param in self.parameters)
     augmented_effect = self.effect
     if costs and (
             self.cost is not None
     ) and not self.cost_included:  # Can only have one cost effect (uses last effect parsed)
         augmented_effect = And(augmented_effect, Cost(self.cost))
     return OPERATOR_PDDL.format(self._pddl_name, self.name,
                                 parameters_pddl, self.condition.pddl(),
                                 augmented_effect.pddl())