X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/c788771aa7185d8f45f0f9705c5460d9749b6303..f6665f4c39a88f3f422c45dfb4287f3ccd73d72a:/src/surf/maxmin.c diff --git a/src/surf/maxmin.c b/src/surf/maxmin.c index 1f1609eba7..e0d093bc1e 100644 --- a/src/surf/maxmin.c +++ b/src/surf/maxmin.c @@ -66,8 +66,11 @@ void lmm_system_free(lmm_system_t sys) lmm_variable_t var = NULL; lmm_constraint_t cnst = NULL; - while ((var = extract_variable(sys))) + while ((var = extract_variable(sys))) { + WARN2("Variable %p (%d) still in LMM system when freing it: this may be a bug", + var,var->id_int); lmm_var_free(sys, var); + } while ((cnst = extract_constraint(sys))) lmm_cnst_free(sys, cnst); @@ -501,6 +504,8 @@ void lmm_solve(lmm_system_t sys) xbt_swag_foreach(cnst, cnst_list) { /* INIT */ cnst->remaining = cnst->bound; + if (cnst->remaining == 0) + continue; cnst->usage = 0; elem_list = &(cnst->element_set); xbt_swag_foreach(elem, elem_list) { @@ -576,14 +581,14 @@ void lmm_solve(lmm_system_t sys) } else { /* FIXME one day: We recompute usage.... :( */ cnst->usage = 0.0; make_elem_inactive(elem); + elem_list = &(cnst->element_set); xbt_swag_foreach(elem, elem_list) { if (elem->variable->weight <= 0) break; if (elem->variable->value > 0) break; if ((elem->value > 0)) { - if (cnst->usage < elem->value / elem->variable->weight) - cnst->usage = elem->value / elem->variable->weight; + cnst->usage=MAX(cnst->usage,elem->value / elem->variable->weight); DEBUG2("Constraint Usage %d : %f", cnst->id_int, cnst->usage); make_elem_active(elem); }