[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r20930: {projects} No longer allow overloaded nodes in hillclimbing (from r6584 (projects/performance/node-selection)



Author: sjm217
Date: 2009-11-09 06:20:52 -0500 (Mon, 09 Nov 2009)
New Revision: 20930

Modified:
   projects/performance/node-selection/hillclimbing.py
Log:
No longer allow overloaded nodes in hillclimbing (from r6584 of local repository)

Modified: projects/performance/node-selection/hillclimbing.py
===================================================================
--- projects/performance/node-selection/hillclimbing.py	2009-11-09 11:19:47 UTC (rev 20929)
+++ projects/performance/node-selection/hillclimbing.py	2009-11-09 11:20:52 UTC (rev 20930)
@@ -36,6 +36,8 @@
 
     loading_factor = xs*prob*totalusage
     broken = (loading_factor < 0.0) | (loading_factor > 1.0)
+    if broken.any():
+        return None
     ## Number of broken nodes
     #print "Broken", len([x for x in broken if x])
 
@@ -125,6 +127,8 @@
 
         ## Calculate the function to optimize
         wwait = calc_waittime(prob, xs, totalusage, True)
+        if wwait is None:
+            continue
         s = wwait.sum()
 
         if s < ss:
@@ -181,13 +185,13 @@
 def main():
     totalusage, anodebw, x, y = test()
     
-    pu = array([1.0/len(anodebw)] * len(anodebw))
+    pt = anodebw/anodebw.sum()
     
     plt.ioff()
     fig = plt.figure()
     ax = fig.add_subplot(111)
 
-    anim = Animator(pu, totalusage, anodebw, fig, ax)
+    anim = Animator(pt, totalusage, anodebw, fig, ax)
 
     win = fig.canvas.manager.window
     fig.canvas.manager.window.after(100, anim.start)