]> AND Private Git Repository - loba.git/blobdiff - process.cpp
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
ag_parameters: set -S0.5 and -g2000.
[loba.git] / process.cpp
index 01b5e0fcc3ce9caab4dcaefb9b25f0a4a8ad3e6e..97f2a69db2e943c01bfdb6e9187856aa073db947 100644 (file)
@@ -295,19 +295,22 @@ void process::convergence_check()
     double load_diff = std::fabs(real_load - average);
     bool converged = load_diff <= load_diff_threshold;
 
     double load_diff = std::fabs(real_load - average);
     bool converged = load_diff <= load_diff_threshold;
 
-    if (convergence >= 0.0) {
-        if (!converged) {
-            XBT_VERB("current load has diverged: %g (%.4g%%)",
-                     real_load, 100.0 * load_diff / average);
-            convergence = -1.0;
-            convergence_counter++;
-        }
-    } else {
-        if (converged) {
+    if (converged) {
+        if (convergence < 0) {
             XBT_VERB("current load has converged: %g (%.4g%%)",
                      real_load,  100.0 * load_diff / average);
             convergence = MSG_get_clock();
             XBT_VERB("current load has converged: %g (%.4g%%)",
                      real_load,  100.0 * load_diff / average);
             convergence = MSG_get_clock();
-            convergence_counter--;
+            local_convergence_counter = opt::exit_on_convergence;
+        }
+        if (local_convergence_counter > 0 && --local_convergence_counter == 0)
+                --convergence_counter;
+    } else {
+        if (convergence >= 0.0) {
+            XBT_VERB("current load has diverged: %g (%.4g%%)",
+                     real_load, 100.0 * load_diff / average);
+            convergence = -1.0;
+            if (local_convergence_counter == 0)
+                ++convergence_counter;
         }
     }
 }
         }
     }
 }