5541828 8 -rw-r--r-- 1 makhoul and 6631 mai 14 2007 ./Desktop/A.Makhoul/DiffusOMNET/Fusion.cc
,----
| void BRITENode::updateLoad(){
-|
+|
| double deltaSum = 0.;
| double deltaMin = this->load;
| for (int i = 0; i < gateSize("out"); i++) {
| double transfer = alpha * delta[i];
| totalSend[i] += transfer;
| this->load -= transfer;
-|
+|
| }
| }
`----
6497742 8 -rw-r--r-- 1 makhoul and 8001 juin 12 2007 ./Desktop/AbdallahMakhoul/Recherche/Diffus-OMNET/Fusion.cc
,----
| void BRITENode::updateLoad(){
-|
+|
| double deltaSum = 0.;
| double deltaMin = this->load;
| for (int i = 0; i < gateSize("out"); i++) {
| double transfer = alpha * delta[i];
| totalSend[i] += transfer;
| this->load -= transfer;
-|
+|
| }
| }
`----
| totalSent = 0.;
| const double alpha = 1.0 / (gateSize("out") + 1);
| const double epsilon = 1.0e-4;
-|
+|
| int nDelta = 0;
| for (int i = 0; i < gateSize("out"); i++) {
| double d = this->load - neighborsLoad[i];
| nDelta++;
| }
| }
-|
+|
| std::sort(Delta, Delta + nDelta, DeltaCompDec());
-|
+|
| double neighborLoadMax = 0.0; // maximum load of neighbors to which
| // something has been sent
| for (int i = 0; i < nDelta; i++) {
| double delta = this->load - neighborsLoad[index];
| if (delta <= epsilon)
| break;
-|
+|
| #if 0
| delta = Delta[i].delta; // does not work well...
| #endif
-|
+|
| double transfer = alpha * delta;
| double transferMax =
| std::min(this->load - neighborLoadMax,
| (this->load - neighborsLoad[index]) / 2.0);
-|
+|
| if (transfer > transferMax) // ping-pong violated?
| transfer = transferMax;
-|
+|
| totalSend[index] += transfer;
| this->load -= transfer;
-|
+|
| double newNeighborLoad = neighborsLoad[index] + transfer;
| if (newNeighborLoad > neighborLoadMax)
| neighborLoadMax = newNeighborLoad;
| }
-|
+|
| // double transfer = alpha * Delta[i].delta;
| // if((this->load - totalSent) >= neighborsLoad[Delta[i].index] + transfer)
| // break;
| // totalSent+=transfer;
| // }
| // }
-|
+|
| // double deltaMax = 1.0e-3; // we consider only positive deltas
| // int iMax = -1; // invalid value
| // for (int i = 0; i < gateSize("out"); i++) {
| // iMax = Delta[i].index;
| // }
| // }
-|
+|
| // if (iMax != -1) {
| // double transfer = alpha * Delta[iMax].delta;
| // totalSend[iMax] += transfer;
| totalSent = 0.;
| const double alpha = 1.0 / (gateSize("out") + 1);
| const double epsilon = par("erreur");
-|
+|
| int nDelta = 0;
| for (int i = 0; i < gateSize("out"); i++) {
| double d = this->load - neighborsLoad[i];
| nDelta++;
| }
| }
-|
+|
| std::sort(Delta, Delta + nDelta, DeltaCompDec());
-|
+|
| double neighborLoadMax = 0.0; // maximum load of neighbors to which
| // something has been sent
| for (int i = 0; i < nDelta; i++) {
| double delta = this->load - neighborsLoad[index];
| if (delta <= epsilon)
| break;
-|
+|
| #if 0
| delta = Delta[i].delta; // does not work well...
| #endif
-|
+|
| double transfer = alpha * delta;
| double transferMax =
| std::min(this->load - neighborLoadMax,
| (this->load - neighborsLoad[index]) / 2.0);
-|
+|
| if (transfer > transferMax) // ping-pong violated?
| transfer = transferMax;
-|
+|
| totalSend[index] += transfer;
| this->load -= transfer;
-|
+|
| double newNeighborLoad = neighborsLoad[index] + transfer;
| if (newNeighborLoad > neighborLoadMax)
| neighborLoadMax = newNeighborLoad;
| }
-|
+|
| // double transfer = alpha * Delta[i].delta;
| // if((this->load - totalSent) >= neighborsLoad[Delta[i].index] + transfer)
| // break;
| // totalSent+=transfer;
| // }
| // }
-|
+|
| // double deltaMax = 1.0e-3; // we consider only positive deltas
| // int iMax = -1; // invalid value
| // for (int i = 0; i < gateSize("out"); i++) {
| // iMax = Delta[i].index;
| // }
| // }
-|
+|
| // if (iMax != -1) {
| // double transfer = alpha * Delta[iMax].delta;
| // totalSend[iMax] += transfer;