Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Added function prototypes in maxmin_private, minor bug corrections in
[simgrid.git] / src / surf / surf.c
index c07e0e5..ee88a0f 100644 (file)
@@ -5,6 +5,8 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
+#include <ctype.h>
+
 #include "surf_private.h"
 #include "xbt/module.h"
 
@@ -12,6 +14,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_kernel, surf,
                                "Logging specific to SURF (kernel)");
 
 int use_sdp_solver=0;
+int use_lagrange_solver=0;
 
 /* Additional declarations for Windows potability. */
 
@@ -142,12 +145,14 @@ double generic_maxmin_share_resources2(xbt_swag_t running_actions,
 
   if(!use_sdp_solver)
     lmm_solve(sys);
-  else {
+  else if(!use_lagrange_solver){
 #ifdef HAVE_SDP
     sdp_solve(sys);
 #else
     xbt_assert0(0, "No CSDP found! You cannot use this model!");
 #endif
+  }else{
+    lagrange_solve(sys);
   }
 
   xbt_swag_foreach(action, running_actions) {
@@ -166,6 +171,7 @@ double generic_maxmin_share_resources2(xbt_swag_t running_actions,
   } else
     min = action->max_duration;
 
+  DEBUG5("Found an action (%p: duration = %f, remains = %f, value = %f) ! %f",action, action->max_duration, action->remains, value, min); 
 
   for (action = xbt_swag_getNext(action, running_actions->offset);
        action;
@@ -173,12 +179,18 @@ double generic_maxmin_share_resources2(xbt_swag_t running_actions,
     value = lmm_variable_getvalue(VARIABLE(action));
     if (value > 0) {
       value = action->remains / value;
-      if (value < min)
+      if (value < min) {
        min = value;
+       DEBUG2("Updating min (value) with %p: %f",action, min);
+      }
     }
-    if ((action->max_duration >= 0) && (action->max_duration < min))
+    if ((action->max_duration >= 0) && (action->max_duration < min)) {
       min = action->max_duration;
+      DEBUG2("Updating min (duration) with %p: %f",action, min);
+    }
   }
+  DEBUG1("min value : %f",min);
+
 #undef VARIABLE
   return min;
 }