3 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(loba);
5 #include "loba_besteffort.h"
7 void loba_besteffort::load_balance()
9 pneigh_sort_by_load(std::less<double>());
10 print_loads_p(false, xbt_log_priority_debug);
12 unsigned bound = pneigh.size();
13 double sum = get_load();
14 for (unsigned i = 0 ; i < bound ; ++i) {
15 if (get_load() <= pneigh[i]->get_load()) {
18 double newsum = sum + pneigh[i]->get_load();
19 if (pneigh[i]->get_load() <= newsum / (i + 2))
26 double mean = sum / (bound + 1);
27 for (unsigned i = 0 ; i < bound ; ++i) {
28 double transfer = mean - pneigh[i]->get_load();
29 send(pneigh[i], transfer);
30 XBT_DEBUG("sent %g to %s", transfer, pneigh[i]->get_name());