Esempio n. 1
0
 def int_update(self, domain, pvars):
     #        print "got here!"
     v = self.get_callee()
     if not isinstance(v, tuple):
         if isinstance(v, Action):
             v = self.apply_actuals(domain, pvars, v)
         #                print "called action: {}".format(v)
         else:
             v = state_to_action(v.value)
     ##                print "called state: {}".format(v)
     return v
Esempio n. 2
0
    def int_update(self,domain,pvars):
#        print "got here!"
        v = self.get_callee()
        if not isinstance(v,tuple):
            if isinstance(v,Action):
                v = self.apply_actuals(domain,pvars,v)
#                print "called action: {}".format(v)
            else:
                v = state_to_action(v.value)
##                print "called state: {}".format(v)
        return v
Esempio n. 3
0
    def get_update_axioms(self,updated,action):
#        print "get_update_axioms: {}, {}".format(map(str,updated),action)
        for x in updated:
            if x in self.dependencies.symbols:
                updated = updated + [y for y in self.defines.symbols if y not in updated]
                try:
                    precond,postcond = next(y for y in (p.match(action) for p in self.patterns.args) if y != None)
                except StopIteration:
                    raise IvyError(action,'No matching update axiom for ' + str(x))
                postcond = state_to_action((updated,postcond,precond))
#                print "update axioms: {}, {}, {}".format(map(str,postcond[0]),postcond[1],postcond[2])
                return (updated,postcond[1],precond)
        return (updated,true_clauses(),false_clauses())
Esempio n. 4
0
 def get_update_axioms(self, updated, action):
     #        print "get_update_axioms: {}, {}".format(map(str,updated),action)
     for x in updated:
         if x in self.dependencies.symbols:
             updated = updated + [y for y in self.defines.symbols if y not in updated]
             try:
                 precond, postcond = next(y for y in (p.match(action) for p in self.patterns.args) if y != None)
             except StopIteration:
                 raise IvyError(action, "No matching update axiom for " + str(x))
             postcond = state_to_action((updated, postcond, precond))
             #                print "update axioms: {}, {}, {}".format(map(str,postcond[0]),postcond[1],postcond[2])
             return (updated, postcond[1], precond)
     return (updated, true_clauses(), false_clauses())
Esempio n. 5
0
    def get_update_axioms(self,updated,action):
#        print "get_update_axioms: {}, {}".format(map(str,updated),action)
        for x in updated:
            if x in self.dependencies.symbols:
                updated = updated + [y for y in self.defines.symbols if y not in updated]
                try:
                    precond,postcond = next(y for y in (p.match(action) for p in self.patterns.args) if y != None)
                except StopIteration:
                    raise IvyError(action,'No matching update axiom for ' + str(x))
                postcond = state_to_action(SemStateValue(updated,postcond,precond))
#                print "update axioms: {}, {}, {}".format(map(str,postcond[0]),postcond[1],postcond[2])
                return SemActionValue(updated,postcond.trans,precond)
        return null_update()
Esempio n. 6
0
    def int_update(self,domain,pvars):
#        print "got here!"
        global context
        name = self.args[0].rep
        v = context.get(name)
#        print "v: {}".format(v)
        if not v:
            raise IvyError(self.args[0],"no value for {}".format(name))
        if not isinstance(v,tuple):
            if isinstance(v,Action):
                v = self.apply_actuals(domain,pvars,v)
#                print "called action: {}".format(v)
            else:
                v = state_to_action(v.value)
##                print "called state: {}".format(v)
        return v
Esempio n. 7
0
    def int_update(self, domain, pvars):
        #        print "got here!"
        global context
        name = self.args[0].rep
        v = context.get(name)
        #        print "v: {}".format(v)
        if not v:
            raise IvyError(self.args[0], "no value for {}".format(name))
        if not isinstance(v, tuple):
            if isinstance(v, Action):
                v = self.apply_actuals(domain, pvars, v)
#                print "called action: {}".format(v)
            else:
                v = state_to_action(v.value)


##                print "called state: {}".format(v)
        return v