Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
bugfix... I'm so pissed off to keep finding bug in this part of the code whereas...
authoralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 1 Feb 2005 17:26:59 +0000 (17:26 +0000)
committeralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 1 Feb 2005 17:26:59 +0000 (17:26 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@840 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/surf/maxmin.c
src/surf/maxmin_private.h

index 44faf0d..4566590 100644 (file)
@@ -62,6 +62,7 @@ void lmm_variable_disable(lmm_system_t sys, lmm_variable_t var)
   for (i = 0; i < var->cnsts_number; i++) {
     elem = &var->cnsts[i];
     xbt_swag_remove(elem, &(elem->constraint->element_set));
   for (i = 0; i < var->cnsts_number; i++) {
     elem = &var->cnsts[i];
     xbt_swag_remove(elem, &(elem->constraint->element_set));
+    xbt_swag_remove(elem, &(elem->constraint->active_element_set));
     if (!xbt_swag_size(&(elem->constraint->element_set)))
       make_constraint_inactive(sys, elem->constraint);
   }
     if (!xbt_swag_size(&(elem->constraint->element_set)))
       make_constraint_inactive(sys, elem->constraint);
   }
@@ -72,7 +73,7 @@ static void lmm_var_free(lmm_system_t sys, lmm_variable_t var)
 {
 
   lmm_variable_disable(sys, var);
 {
 
   lmm_variable_disable(sys, var);
-
+  memset(var->cnsts,0,var->cnsts_size*sizeof(s_lmm_element_t));
   xbt_free(var->cnsts);
   xbt_free(var);
 }
   xbt_free(var->cnsts);
   xbt_free(var);
 }
@@ -274,7 +275,7 @@ void lmm_solve(lmm_system_t sys)
       if(elem->variable->weight <=0) break;
       if ((elem->value > 0)) {
        cnst->usage += elem->value / elem->variable->weight;
       if(elem->variable->weight <=0) break;
       if ((elem->value > 0)) {
        cnst->usage += elem->value / elem->variable->weight;
-       insert_active_elem_in_constraint(elem);
+       make_elem_active(elem);
       }
     }
 
       }
     }
 
@@ -312,7 +313,7 @@ void lmm_solve(lmm_system_t sys)
        cnst = elem->constraint;
        cnst->remaining -= elem->value * var->value;
        cnst->usage -= elem->value / var->weight;
        cnst = elem->constraint;
        cnst->remaining -= elem->value * var->value;
        cnst->usage -= elem->value / var->weight;
-       remove_active_elem_in_constraint(elem);
+       make_elem_inactive(elem);
       }
       xbt_swag_remove(var, var_list);
     }
       }
       xbt_swag_remove(var, var_list);
     }
index 2b0ae5f..28e1fb8 100644 (file)
@@ -20,8 +20,8 @@ typedef struct lmm_element {
   lmm_variable_t variable;
   double value;
 } s_lmm_element_t, *lmm_element_t;
   lmm_variable_t variable;
   double value;
 } s_lmm_element_t, *lmm_element_t;
-#define insert_active_elem_in_constraint(elem) xbt_swag_insert_at_head(elem,&(elem->constraint->active_element_set))
-#define remove_active_elem_in_constraint(elem) xbt_swag_remove(elem,&(elem->constraint->active_element_set))
+#define make_elem_active(elem) xbt_swag_insert_at_head(elem,&(elem->constraint->active_element_set))
+#define make_elem_inactive(elem) xbt_swag_remove(elem,&(elem->constraint->active_element_set))
 
 typedef struct lmm_constraint {
   /* hookup to system */
 
 typedef struct lmm_constraint {
   /* hookup to system */