X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/49e85177c669d793e84242983a1b1f430e47184e..578dd56a4a07709db1922ff5edd98f0c8f3090f9:/src/surf/lagrange.cpp diff --git a/src/surf/lagrange.cpp b/src/surf/lagrange.cpp index c62055b5c3..9257a84c6a 100644 --- a/src/surf/lagrange.cpp +++ b/src/surf/lagrange.cpp @@ -52,18 +52,17 @@ static int __check_feasible(xbt_swag_t cnst_list, xbt_swag_t var_list, double tmp; xbt_swag_foreach(_cnst, cnst_list) { - cnst = (lmm_constraint_t)_cnst; + cnst = (lmm_constraint_t)_cnst; tmp = 0; - elem_list = &(cnst->element_set); + elem_list = &(cnst->enabled_element_set); xbt_swag_foreach(_elem, elem_list) { elem = (lmm_element_t)_elem; var = elem->variable; - if (var->weight <= 0) - continue; + xbt_assert(var->weight > 0); tmp += var->value; } - if (double_positive(tmp - cnst->bound)) { + if (double_positive(tmp - cnst->bound, sg_maxmin_precision)) { if (warn) XBT_WARN ("The link (%p) is over-used. Expected less than %f and got %f", @@ -76,7 +75,7 @@ static int __check_feasible(xbt_swag_t cnst_list, xbt_swag_t var_list, } xbt_swag_foreach(_var, var_list) { - var = (lmm_variable_t)_var; + var = (lmm_variable_t)_var; if (!var->weight) break; if (var->bound < 0) @@ -84,7 +83,7 @@ static int __check_feasible(xbt_swag_t cnst_list, xbt_swag_t var_list, XBT_DEBUG("Checking feasability for variable (%p): sat = %f mu = %f", var, var->value - var->bound, var->mu); - if (double_positive(var->value - var->bound)) { + if (double_positive(var->value - var->bound, sg_maxmin_precision)) { if (warn) XBT_WARN ("The variable (%p) is too large. Expected less than %f and got %f", @@ -135,7 +134,7 @@ static double dual_objective(xbt_swag_t var_list, xbt_swag_t cnst_list) double obj = 0.0; xbt_swag_foreach(_var, var_list) { - var = (lmm_variable_t)_var; + var = (lmm_variable_t)_var; double sigma_i = 0.0; int j; @@ -171,7 +170,7 @@ void lagrange_solve(lmm_system_t sys) * Lagrange Variables. */ int max_iterations = 100; - double epsilon_min_error = MAXMIN_PRECISION; + double epsilon_min_error = 0.00001; /* this is the precision on the objective function so it's none of the configurable values and this value is the legacy one */ double dichotomy_min_error = 1e-14; double overall_modification = 1; @@ -215,7 +214,7 @@ void lagrange_solve(lmm_system_t sys) */ cnst_list = &(sys->active_constraint_set); xbt_swag_foreach(_cnst, cnst_list) { - cnst = (lmm_constraint_t)_cnst; + cnst = (lmm_constraint_t)_cnst; cnst->lambda = 1.0; cnst->new_lambda = 2.0; XBT_DEBUG("#### cnst(%p)->lambda : %e", cnst, cnst->lambda); @@ -228,7 +227,7 @@ void lagrange_solve(lmm_system_t sys) var_list = &(sys->variable_set); i = 0; xbt_swag_foreach(_var, var_list) { - var = (lmm_variable_t)_var; + var = (lmm_variable_t)_var; if (!var->weight) var->value = 0.0; else { @@ -397,7 +396,6 @@ static double dichotomy(double init, double diff(double, void *), min = max = 0.5; } - min_diff = max_diff = middle_diff = 0.0; overall_error = 1; if ((diff_0 = diff(1e-16, var_cnst)) >= 0) { @@ -502,16 +500,14 @@ static double partial_diff_lambda(double lambda, void *param_cnst) double sigma_i = 0.0; XBT_IN(); - elem_list = &(cnst->element_set); + elem_list = &(cnst->enabled_element_set); XBT_CDEBUG(surf_lagrange_dichotomy, "Computing diff of cnst (%p)", cnst); xbt_swag_foreach(_elem, elem_list) { - elem = (lmm_element_t)_elem; + elem = (lmm_element_t)_elem; var = elem->variable; - if (var->weight <= 0) - continue; - + xbt_assert(var->weight > 0); XBT_CDEBUG(surf_lagrange_dichotomy, "Computing sigma_i for var (%p)", var); // Initialize the summation variable