max = l;
}
}
- if (imin != -1) {
- // found someone
- double balance = (get_load() - max) / 2;
- XBT_DEBUG("%d:%g %d:%g %g %g", imin, min, imax, max, get_load(), balance);
+ if (imin != -1) { // found someone
+ double balance = std::min((get_load() - min) / 2.0,
+ (get_load() - max));
+ XBT_DEBUG("%d:%g %d:%g %g %g",
+ imin, min, imax, max, get_load(), balance);
send(pneigh[imin], balance);
}
}