Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
don't trust gcc for cleaning your code after you. he's too dumb to be trusted
[simgrid.git] / src / surf / maxmin.c
index 37d53c7..ce9d3ad 100644 (file)
@@ -53,9 +53,6 @@ lmm_system_t lmm_system_new(void)
   xbt_swag_init(&(l->saturated_constraint_set),
                 xbt_swag_offset(cnst, saturated_constraint_set_hookup));
 
-  xbt_swag_init(&(l->modified_variable_set),
-                xbt_swag_offset(var, modified_variable_set_hookup));
-
   l->variable_mallocator = xbt_mallocator_new(64,
                                               lmm_variable_mallocator_new_f,
                                               lmm_variable_mallocator_free_f,
@@ -494,38 +491,18 @@ void lmm_solve(lmm_system_t sys)
     //DEBUG1("Variable set : %d", xbt_swag_size(elem_list));
     xbt_swag_foreach(elem, elem_list) {
       var = elem->variable;
-      xbt_swag_insert(var, &(sys->modified_variable_set));
-      /* FIXME: modified this test because we need all actions in cpu_im */
       if (var->weight <= 0.0)
-        //break;
-        continue;
+        break;
       var->value = 0.0;
     }
   }
 
-  /* Init: special case where all constraints are 0 */
-  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;
-    if (var->weight <= 0.0)
-      break;
-    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;
-  }
-
   DEBUG1("Active constraints : %d", xbt_swag_size(cnst_list));
   xbt_swag_foreach(cnst, cnst_list) {
     /* INIT */
     cnst->remaining = cnst->bound;
     cnst->usage = 0;
     elem_list = &(cnst->element_set);
-    cnst->usage = 0.0;
     xbt_swag_foreach(elem, elem_list) {
       /* 0-weighted elements (ie, sleep actions) are at the end of the swag and we don't want to consider them */
       if (elem->variable->weight <= 0)
@@ -572,7 +549,6 @@ void lmm_solve(lmm_system_t sys)
 
     while ((var = xbt_swag_getFirst(var_list))) {
       int i;
-      xbt_swag_insert(var, &(sys->modified_variable_set));
 
       if (min_bound < 0) {
         var->value = min_usage / var->weight;
@@ -619,8 +595,7 @@ void lmm_solve(lmm_system_t sys)
 
     /* Find out which variables reach the maximum */
     cnst_list =
-      sys->selective_update_active ? &(sys->
-                                       modified_constraint_set) :
+      sys->selective_update_active ? &(sys->modified_constraint_set) :
       &(sys->active_constraint_set);
     min_usage = -1;
     min_bound = -1;
@@ -801,12 +776,3 @@ static void lmm_remove_all_modified_set(lmm_system_t sys)
     xbt_swag_remove(elem, elem_list);
   }
 }
-
-void *lmm_extract_modified_variable(lmm_system_t sys)
-{
-  lmm_variable_t var;
-  var = xbt_swag_extract(&(sys->modified_variable_set));
-  if (var)
-    return var->id;
-  return NULL;
-}