X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/blobdiff_plain/d568decaa9d3c62d0da2a32d2c636b4ed7fb8063..f483eedcc241fabb1210b5800d903989202ad9fe:/loba_makhoul2.cpp?ds=sidebyside diff --git a/loba_makhoul2.cpp b/loba_makhoul2.cpp index 6d7d12e..d0cf20a 100644 --- a/loba_makhoul2.cpp +++ b/loba_makhoul2.cpp @@ -16,11 +16,14 @@ void loba_makhoul2::load_balance() double neighborLoadMax = 0.0; // maximum load of neighbors to // which something has been sent for (unsigned i = 0; - i < pneigh.size() && pneigh[i]->get_load() < get_load(); i++) { + i < pneigh.size() && pneigh[i]->get_load() < get_load(); ++i) + { + double delta = get_load() - pneigh[i]->get_load(); // do not violate ping-pong condition double transfer = std::min(alpha * delta, get_load() - neighborLoadMax); + // note: alpha <= 1/2 XBT_DEBUG("delta = %g ; transfer = %g", delta, transfer); send(pneigh[i], transfer);