def run (self, index): tmpIndex = index if (node.debugMode): if not(self.hasDebugChild()): res = self.runAsBaseCase(index) if res!=None: return res else: if not(self.reset): self.clear() debug = node.run(self, index) if (debug!=None): return debug a = [True, 0] # index = 1 child = self.getChildren() b = child[0].run(index) a[0] = not(b[0]) a[1] = b[1] if (self.monitor): if a[0]: self.setDistTableSuccAtIndex(tmpIndex, a[1]) else: self.setDistTableFailAtIndex(tmpIndex, a[1]) self.updateProbTableAtIndex(tmpIndex, a[0]) return a
def run(self, index): runResult = [self.boolP, 0] tmpIndex = index if (node.debugMode): if not (self.hasDebugChild()): res = self.runAsBaseCase(index) if res != None: return res else: if not (self.reset): self.clear() debug = node.run(self, index) if (debug != None): runResult[1] = debug[1] return runResult a = [self.boolP, 0] # index = 1 child = self.getChildren() b = child[0].run(index) a[1] = b[1] if (self.monitor): if a[0]: self.setDistTableSuccAtIndex(tmpIndex, a[1]) else: self.setDistTableFailAtIndex(tmpIndex, a[1]) self.updateProbTableAtIndex(tmpIndex, a[0]) return a
def run(self, index): tmpIndex = index if (node.debugMode): if not(self.hasDebugChild()): res = self.runAsBaseCase(index) if res!=None: return res else: if not(self.reset): self.clear() debug = node.run(self, index) if (debug!=None): return debug #Changed to the following logic: Parallel runs untils one of its children finishes, and returns that child's result. (RAZ) a = [True, float("inf")] for i in self.getChildren(): b = i.run(index) if b[1]<a[1]: a[0]=b[0] a[1]=b[1] if (self.monitor): if a[0]: self.setDistTableSuccAtIndex(tmpIndex, a[1]) else: self.setDistTableFailAtIndex(tmpIndex, a[1]) self.updateProbTableAtIndex(tmpIndex, a[0]) return a
def run(self, index): tmpIndex = index if (node.debugMode): if not (self.hasDebugChild()): res = self.runAsBaseCase(index) if res != None: return res else: if not (self.reset): self.clear() debug = node.run(self, index) if (debug != None): return debug a = [True, 0] loopBreak = 0 child = self.getChildren() while a[0] and loopBreak <= 100: b = child[0].run(index) a[0] = a[0] and b[0] a[1] = a[1] + b[1] if not b[0]: break loopBreak = loopBreak + 1 if (self.monitor): if a[0]: self.setDistTableSuccAtIndex(tmpIndex, a[1]) else: self.setDistTableFailAtIndex(tmpIndex, a[1]) self.updateProbTableAtIndex(tmpIndex, a[0]) return a
def run (self, index): tmpIndex = index if (node.debugMode): if not(self.hasDebugChild()): res = self.runAsBaseCase(index) if res!=None: return res else: if not(self.reset): self.clear() debug = node.run(self, index) if (debug!=None): return debug a = [False, 0] for i in self.getChildren(): b = i.run(index) a[0] = a[0] or b[0] a[1] = a[1] + b[1] if b[0]: break if (self.monitor): if a[0]: self.setDistTableSuccAtIndex(tmpIndex, a[1]) else: self.setDistTableFailAtIndex(tmpIndex, a[1]) self.updateProbTableAtIndex(tmpIndex, a[0]) return a
def run(self, index): debug = node.run(self, index) if (debug != None): return debug a = [True, 0] a[0] = self.getRandomProb(index) if a[0]: a[1] = round(self.getDistSuccByIndex(index).calcProb()) else: a[1] = round(self.getDistFailByIndex(index).calcProb()) return a
def run (self, index): debug = node.run(self, index) if (debug!=None): return debug a = [True, 0] a[0]= self.getRandomProb(index) if a[0]: a[1] = round(self.getDistSuccByIndex(index).calcProb()) else: a[1] = round(self.getDistFailByIndex(index).calcProb()) return a