def visit_problem_def(self, node): """Visits a PDDL-problem definition.""" # Check whether the in the problem file referenced domain name matches # the supplied domain data structure. if node.domainName != self._domain.name: raise SemanticError('Error trying to parse problem file with ' 'domain: %s together with a domain file that ' 'specifies domain: %s' % (node.domainName, self._domain.name)) # Apply to all object definitions. for o in node.objects: o.accept(self) # Apply to the initial state definition. node.init.accept(self) init_list = self.get_in(node.init) # Apply to the goal state definition. node.goal.accept(self) goal_list = self.get_in(node.goal) if node.constraints: node.constraints.predicates.extend(goal_list) node.constraints.init_predicates.extend(init_list) # Apply to the constraints state definition. node.constraints.accept(self) constraints_dict = self.get_in(node.constraints) else: constraints_dict = {} # Create the problem data structure. self._problemDef = pddl.Problem(node.name, self._domain, self._objects, init_list, goal_list, constraints_dict)
def visit_problem_def(self, node): """Visits a PDDL-problem definition.""" # Check whether the in the problem file referenced domain name matches # the supplied domain data structure. if node.domainName != self._domain.name: raise SemanticError( "Error trying to parse problem file with " "domain: %s together with a domain file that " "specifies domain: %s" % (node.domainName, self._domain.name) ) # Apply to all object definitions. for o in node.objects: o.accept(self) # Apply to the initial state definition. node.init.accept(self) init_list = self.get_in(node.init) # Apply to the goal state definition. node.goal.accept(self) goal_list = self.get_in(node.goal) # Create the problem data structure. self._problemDef = pddl.Problem( node.name, self._domain, self._objects, init_list, goal_list )