]> AND Private Git Repository - loba.git/commitdiff
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
Use the correct algorithm to find the bound.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Thu, 24 Feb 2011 15:13:35 +0000 (16:13 +0100)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Thu, 24 Feb 2011 15:13:35 +0000 (16:13 +0100)
Should not change result, just be slightly faster.

loba_makhoul.cpp

index 2fca60b5ba5f18d1f8dc9782e49acdd0ebde6114..dcce7b730d90c30203dbc084454149ccd0b76ab6 100644 (file)
@@ -10,6 +10,7 @@ void loba_makhoul::load_balance()
 {
     using std::tr1::bind;
     using std::tr1::placeholders::_1;
+    using std::tr1::placeholders::_2;
 
     pneigh_sort_by_load(std::less<double>());
 
@@ -17,9 +18,10 @@ void loba_makhoul::load_balance()
 
     // find limit between least loaded neighbors, and more loaded ones
     pneigh_type::iterator bound =
-        std::find_if(pneigh.begin(), pneigh.end(),
-                     bind(std::less_equal<double>(),
-                          get_load(), bind(&neighbor::get_load, _1)));
+        std::lower_bound(pneigh.begin(), pneigh.end(),
+                         get_load(),
+                         bind(std::less<double>(),
+                              bind(&neighbor::get_load, _1), _2));
 
     // compute load differences
     std::vector<double> delta(bound - pneigh.begin());