3 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(loba);
5 #include "loba_makhoul.h"
7 void loba_makhoul::load_balance()
9 pneigh_sort_by_load(std::less<double>());
10 print_loads_p(false, xbt_log_priority_debug);
12 double alpha = 1.0 / (pneigh.size() + 1.0);
13 double my_load = get_load();
16 cont && i < pneigh.size() && pneigh[i]->get_load() < my_load ; ++i) {
18 double delta = my_load - pneigh[i]->get_load();
19 double transfer = alpha * delta;
20 XBT_DEBUG("delta = %g ; transfer = %g", delta, transfer);
21 if (pneigh[i]->get_load() + transfer <= get_load() - transfer) {
22 send(pneigh[i], transfer);
23 XBT_DEBUG("sent %g to %s", transfer, pneigh[i]->get_name());