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();
18 for (i = 0; i < size; ++i) {
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) {
26 (myLoad - pneigh[listLessLoadedNeighbors[i]]->get_load()) /
27 (nbLessLoadedNeighbors + 1);
28 if (myLoad - delta > pneigh[listLessLoadedNeighbors[i]]->get_load()) {
33 for (i = 0; i < size; ++i) {
34 send(pneigh[i], S[i]);
35 XBT_DEBUG("sent to %s", pneigh[i]->get_name());