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>());
11 print_loads_p(false, xbt_log_priority_debug);
13 double alpha = 1.0 / (pneigh.size() + 1.0);
14 double my_load = get_load();
17 cont && i < pneigh.size() && pneigh[i]->get_load() < my_load ; ++i) {
19 double delta = my_load - pneigh[i]->get_load();
20 double transfer = alpha * delta;
21 XBT_DEBUG("delta = %g ; transfer = %g", delta, transfer);
22 if (pneigh[i]->get_load() + transfer <= get_load() - transfer) {
23 send(pneigh[i], transfer);
24 XBT_DEBUG("sent %g to %s", transfer, pneigh[i]->get_name());