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

Private GIT Repository
Use the correct algorithm to find the bound.
[loba.git] / 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::bind;
     using std::tr1::placeholders::_1;
+    using std::tr1::placeholders::_2;
 
     pneigh_sort_by_load(std::less<double>());
 
 
     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 =
 
     // 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());
 
     // compute load differences
     std::vector<double> delta(bound - pneigh.begin());