Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
This file needs stdio.h for sprintf (it could use bprintf instead, but that's another...
[simgrid.git] / src / surf / maxmin.c
index 9b98902..405a409 100644 (file)
@@ -11,6 +11,7 @@
 #include "xbt/mallocator.h"
 #include "maxmin_private.h"
 #include <stdlib.h>
+#include <stdio.h> /* sprintf */
 #include <math.h>
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_maxmin, surf,
                                "Logging specific to SURF (maxmin)");
@@ -374,6 +375,7 @@ void lmm_print(lmm_system_t sys)
   DEBUG1("%s", trace_buf);
   trace_buf[0] = '\000';
 
+  DEBUG0("Constraints");
   /* Printing Constraints */
   cnst_list = &(sys->active_constraint_set);
   xbt_swag_foreach(cnst, cnst_list) {
@@ -411,6 +413,7 @@ void lmm_print(lmm_system_t sys)
            sum, cnst->bound, sum - cnst->bound);
   }
 
+  DEBUG0("Variables");
   /* Printing Result */
   xbt_swag_foreach(var, var_list) {
     if (var->bound > 0) {
@@ -443,7 +446,14 @@ void lmm_solve(lmm_system_t sys)
   var_list = &(sys->variable_set);
   DEBUG1("Variable set : %d", xbt_swag_size(var_list));
   xbt_swag_foreach(var, var_list) {
+    int nb=0;
+    int i;
     var->value = 0.0;
+    for (i = 0; i < var->cnsts_number; i++) {
+      if(var->cnsts[i].value==0.0) nb++;
+    }
+    if((nb==var->cnsts_number) && (var->weight>0.0))
+      var->value = 1.0;
   }
 
   /*