Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
bugfix revealed by making maxmin_system private...
[simgrid.git] / src / surf / fair_bottleneck.c
index 51aef93..46be77f 100644 (file)
@@ -69,7 +69,12 @@ void bottleneck_solve(lmm_system_t sys)
    * Compute Usage and store the variables that reach the maximum.
    */
   while (1) {
+/*     if (XBT_LOG_ISENABLED(surf_maxmin, xbt_log_priority_debug)) { */
+/*       DEBUG0("Fair bottleneck done"); */
+/*       lmm_print(sys); */
+/*     } */
     DEBUG1("******* Constraints to process: %d *******", xbt_swag_size(cnst_list));
+    min_usage = -1;
     xbt_swag_foreach_safe(cnst, cnst_next, cnst_list) {
       int nb = 0;
       double max_elem = 0.0;
@@ -98,6 +103,7 @@ void bottleneck_solve(lmm_system_t sys)
        xbt_swag_remove(cnst, cnst_list);
        continue;
       }
+
       /* Saturated constraints update */
       if (min_usage < 0 || min_usage > cnst->remaining / cnst->usage) {
        DEBUG3("Update min_usage (%g) with cnst %p -> %g",min_usage, cnst,
@@ -113,6 +119,8 @@ void bottleneck_solve(lmm_system_t sys)
        DEBUG2("Keep   min_usage (%g) with cnst %p",min_usage, cnst);
        xbt_swag_remove(cnst, cnst_list);
        xbt_swag_insert(cnst, &(cnst_to_update));
+      } else {
+       DEBUG1("\tmin_usage: %f. No update",min_usage);
       }
     }
 
@@ -121,6 +129,7 @@ void bottleneck_solve(lmm_system_t sys)
 
     while ((cnst_next = xbt_swag_extract(&cnst_to_update))) {
       int nb = 0;
+      double remaining = cnst_next->remaining;
       elem_list = &(cnst_next->element_set);
       xbt_swag_foreach(elem, elem_list) {
        if (elem->variable->weight <= 0)
@@ -142,7 +151,7 @@ void bottleneck_solve(lmm_system_t sys)
          break;
        if (var->value == 0.0) {
          DEBUG2("\tUpdating var %p (%g)",var,var->value);
-         var->value = var->weight * cnst_next->remaining / (nb * elem->value);
+         var->value = var->weight * remaining / (nb * elem->value);
 
          /* Update usage */