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

Private GIT Repository
Correctly initialize members for deployment_generator::host_parameters.
[loba.git] / loba_makhoul.cpp
1 #include <algorithm>
2 #include <xbt/log.h>
3
4 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(loba);
5
6 #include "loba_makhoul.h"
7
8 void loba_makhoul::load_balance()
9 {
10     std::sort(pneigh.begin(), pneigh.end(), pneigh_load_less());
11
12     print_loads_p(false, xbt_log_priority_debug);
13
14     double alpha = 1.0 / (pneigh.size() + 1.0);
15     double delta;
16     for (unsigned i = 0 ;
17          i < pneigh.size() &&
18              (delta = get_load() - pneigh[i]->get_load()) > 0.0 ;
19          ++i) {
20         send(pneigh[i], delta * alpha);
21     }
22 }
23
24 // Local variables:
25 // mode: c++
26 // End: