예제 #1
0
    def visit_action_stmt(self, node):
        """Visits a PDDL action statement."""
        signature = list()
        # Visit all parameters and create signature.

        for v in node.parameters:
            v.accept(self)
            signatureTuple = self.get_in(v)
            signature.append(signatureTuple)

        # Visit the precondition statement.
        if not node.precond is None:
            node.precond.accept(self)
            precond = self.get_in(node.precond)
        else:
            precond = None

        # Visit the effect statement.
        node.effect.accept(self)
        effect = self.get_in(node.effect)

        #Visit the decomp statement
        try:
            node.decomp.accept(self)
            decomp = self.get_in(node.decomp)
            self.set_in(
                node, pddl.Action(node.name, signature, precond, effect,
                                  decomp))
        except:
            # Create new PDDL action and store in node.
            self.set_in(node, pddl.Action(node.name, signature, precond,
                                          effect))
예제 #2
0
    def visit_action_stmt(self, node):
        """Visits a PDDL action statement."""
        signature = list()
        # Visit all parameters and create signature.
        for v in node.parameters:
            v.accept(self)
            signatureTuple = self.get_in(v)
            signature.append(signatureTuple)

        # Visit the precondition statement.
        node.precond.accept(self)
        precond = self.get_in(node.precond)

        # Visit the effect statement.
        node.effect.accept(self)
        effect = self.get_in(node.effect)

        # Visit the possible precondition statement.
        node.possible_precond.accept(self)
        poss_precond = self.get_in(node.possible_precond)

        # Visit the possible effect statement.
        node.possible_effect.accept(self)
        poss_effect = self.get_in(node.possible_effect)

        # Create new PDDL action and store in node.
        self.set_in(
            node,
            pddl.Action(node.name, signature, precond, effect, poss_precond,
                        poss_effect))
예제 #3
0
    def visit_action_stmt(self, node):
        """Visits a PDDL action statement."""
        signature = list()
        # Visit all parameters and create signature.
        for v in node.parameters:
            v.accept(self)
            signatureTuple = self.get_in(v)
            signature.append(signatureTuple)

        # Visit the precondition statement.
        node.precond.accept(self)
        precond = self.get_in(node.precond)

        # Visit the effect statement.
        node.effect.accept(self)
        effect = self.get_in(node.effect)

        # Give agent type
        agents = []
        if node.agent:
            for agent in node.agent:
                agents.append(agent.types[0])

        # Create new PDDL action and store in node.
        self.set_in(node,
                    pddl.Action(node.name, agents, signature, precond, effect))