def p_typed_constants_lst(self, p): """typed_constants_lst : constants_lst HYPHEN type typed_constants_lst | constants_lst HYPHEN type""" if len(p) == 4: p[0] = [Term.constant(value, p[3]) for value in p[1]] elif len(p) == 5: p[0] = [Term.constant(value, p[3]) for value in p[1]] + p[4]
def test_problem_objects(self): """Test that the objects are correct.""" assert self.pddl_objects == [ Term.constant("l11", "location"), Term.constant("l12", "location"), Term.constant("l13", "location"), Term.constant("l21", "location"), Term.constant("l22", "location"), Term.constant("l23", "location"), Term.constant("l31", "location"), Term.constant("l32", "location"), Term.constant("l33", "location"), ]
def make_new_goal(self, final_states, obj_list): """Modify the goal state.""" self._goal = None # self._goal # self.new_goal.add("(turnDomain)") # self._goal.add('(turnDomain)') turn_domain = Predicate("turnDomain") if len(final_states) > 1: or_list = [] for state in final_states: if obj_list: # or_list.append("(q{0} {1})".format(str(state), " ".join(obj_list))) or_list.append( Predicate( "q{0}".format(str(state)), [Term.constant(obj) for obj in obj_list], )) else: or_list.append(Predicate("q{0}".format(str(state)))) new_formula = FormulaOr(or_list) # self._goal.add(str(new_formula)) # self.new_goal.add(str(new_formula)) self._goal = FormulaAnd([new_formula, turn_domain]) else: and_list = [] # self._goal.add('(= q {0})'.format(final_states[0])) if obj_list: and_list.append( Predicate( "q{0}".format(final_states[0]), [Term.constant(obj) for obj in obj_list], )) # self.new_goal.add( # "(q{0} {1})".format(final_states[0], " ".join(obj_list)) # ) else: and_list.append(Predicate("q{0}".format(final_states[0]))) # self.new_goal.add("(q{0})".format(final_states[0])) self._goal = FormulaAnd(and_list + [turn_domain])
def test_problem_objects(self): """Test that the objects are correct.""" assert self.pddl_objects == [ Term.constant("p0", "location"), Term.constant("p1", "location"), ]