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

Private GIT Repository
Bug fix: only send to a lesser loaded neighbor!
[loba.git] / loba_fairstrategy.cpp
index 7495655b2b575c733322f42b698859f41bc7317f..9942fac1b1847616a9518788df811ceb2d38cb0e 100644 (file)
@@ -29,10 +29,7 @@ double loba_fairstrategy::load_balance(double my_load)
     while (found) {
         found = false;
         for (unsigned i = 0 ; i < pneigh.size() ; ++i) {
     while (found) {
         found = false;
         for (unsigned i = 0 ; i < pneigh.size() ; ++i) {
-            double l = pneigh[i]->get_load();
-            if (l >= my_load)
-                continue;
-            if (l < my_load + 2) {
+            if (pneigh[i]->get_load() <= my_load - 2) {
                 found = true;
                 pneigh[i]->add_load(1);
                 pneigh[i]->add_to_send(1);
                 found = true;
                 pneigh[i]->add_load(1);
                 pneigh[i]->add_to_send(1);