4 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(loba);
8 void loba_lln::load_balance()
10 std::vector<int> listLessLoadedNeighbors;
12 double myLoad = get_load();
13 unsigned size = pneigh.size();
14 double *S = new double[size];
15 double lessLoad = get_load();
17 listLessLoadedNeighbors.clear();
20 if( pneigh[i]->get_load()< lessLoad )
21 listLessLoadedNeighbors.push_back(i);
23 int nbLessLoadedNeighbors=listLessLoadedNeighbors.size();
24 for( i=0; i<listLessLoadedNeighbors.size(); ++i) {
25 double delta = (myLoad-pneigh[listLessLoadedNeighbors[i]]->get_load())/(nbLessLoadedNeighbors+1);
26 if(myLoad-delta > pneigh[listLessLoadedNeighbors[i]]->get_load()) {
31 for(i=0; i<size; ++i) {
32 send(pneigh[i], S[i]);
33 XBT_DEBUG("sent to %s", pneigh[i]->get_name());