Exemple #1
0
    def getCriticalStats(self, lowerTime, upperTime):
        delivery = []
        overhead = []
        for node in self.itervalues():
            d,o = node.getCriticalStats(lowerTime, upperTime)
            delivery.extend(d)
            overhead.extend(o)

        if(len(delivery) == 0):
            return -1,-1
        elif(len(delivery) == 1):
            return delivery[0],overhead[0]
        else:
            avgDelivery = average(delivery)
            avgOverhead = average(overhead)
            return avgDelivery, avgOverhead
Exemple #2
0
    def getCostPerNeighbor(self, lowerTime, upperTime):
        sentPerRecipient = []
        for node in self.itervalues():
            sentPerRecipient.extend(node.getCostPerNeighbor(lowerTime,upperTime))

        # Find max and min
        maxNgh = -1
        minNgh = sys.maxint
        for i in sentPerRecipient:
            if(i > maxNgh):
                maxNgh = i                
            if(i < minNgh):
                minNgh = i
        if(len(sentPerRecipient) == 0):
            return -1,-1,-1,-1
        elif(len(sentPerRecipient) == 1):
            return sentPerRecipient[0],0,sentPerRecipient[0],sentPerRecipient[0]
        else:
            return average(sentPerRecipient), standardDeviation(sentPerRecipient),minNgh,maxNgh