Exemplo n.º 1
0
 def graph_update(self):
     p = dijkstra.random_path(self.g, self.a)
     if (randint(1, 2) == 2):
         for e in p:
             #print "Check 1"
             self.d[e] = min(10000, self.d[e] + randint(1000, 2000))
             #print "Check 2"
             self.d_adapt[e].update(lambda x = self.d[e]: x)
             #print "Check 3"
             #self.d_value[e].update(lambda x = self.d[e]: x)
     else:
         for e in p:
             self.d[e] = max(1, self.d[e] - randint(1000, 2000))
             self.d_adapt[e].update(lambda x = self.d[e]: x)
Exemplo n.º 2
0
 def graph_update_value(self):
     #print "Check 1"
     p = dijkstra.random_path(self.g, self.a)
     #print "Check 2"
     if (randint(1, 2) == 2):
         #print "Check 3"
         for e in p:
             self.d[e] = min(10000, self.d[e] + randint(1000, 2000))
             self.d_adapt[e].update(self.d[e])
             #self.d_value[e].update(self.d[e])
             #print "Check 4"
     else:
         for e in p:
             self.d[e] = max(1, self.d[e] - randint(1000, 2000))
             self.d_adapt[e].update(self.d[e])