コード例 #1
0
ファイル: notnode.py プロジェクト: raznis/prototype1.1.13
    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    
コード例 #2
0
    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
コード例 #3
0
ファイル: parallelnode.py プロジェクト: alonzanbar/robil
    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
コード例 #4
0
ファイル: loopnode.py プロジェクト: iosp/robil2
    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
コード例 #5
0
    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    
コード例 #6
0
 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
コード例 #7
0
ファイル: tsknode.py プロジェクト: raznis/prototype1.1.13
 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