1 #include "loba_fairstrategy.h"
5 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(loba);
8 * load balance with a least-loaded neighbor,
9 * without breaking the ping-pong condition
14 bool operator()(const neighbor*a, const neighbor*b) {
15 return a->get_load()>b->get_load();
19 double loba_fairstrategy::load_balance(double my_load)
26 std::sort(pneigh.begin(),pneigh.end(),compare());
30 INFO0("list voisins");
31 for(unsigned i=0;i< pneigh.size() ; ++i) {
32 INFO2("%s %f ", pneigh[i]->get_name(), pneigh[i]->get_load());
40 for (unsigned i = 0 ; i < pneigh.size() ; ++i) {
41 double l = pneigh[i]->get_load();
46 pneigh[i]->set_load(l+1);
47 pneigh[i]->add_to_send(1);
48 INFO1("sent to %s",pneigh[i]->get_name());