A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Protect DllMain with ifndef GNUC
[simgrid.git]
/
src
/
surf
/
maxmin.c
diff --git
a/src/surf/maxmin.c
b/src/surf/maxmin.c
index
34fb128
..
db76f87
100644
(file)
--- a/
src/surf/maxmin.c
+++ b/
src/surf/maxmin.c
@@
-25,7
+25,6
@@
static void lmm_update_modified_set(lmm_system_t sys,
static void lmm_remove_all_modified_set(lmm_system_t sys);
static int Global_debug_id = 1;
static int Global_const_debug_id = 1;
static void lmm_remove_all_modified_set(lmm_system_t sys);
static int Global_debug_id = 1;
static int Global_const_debug_id = 1;
-extern xbt_swag_t keep_track;
lmm_system_t lmm_system_new(int selective_update)
{
lmm_system_t lmm_system_new(int selective_update)
{
@@
-37,6
+36,7
@@
lmm_system_t lmm_system_new(int selective_update)
l->modified = 0;
l->selective_update_active = selective_update;
l->modified = 0;
l->selective_update_active = selective_update;
+ l->visited_counter = 1;
XBT_DEBUG("Setting selective_update_active flag to %d\n",
l->selective_update_active);
XBT_DEBUG("Setting selective_update_active flag to %d\n",
l->selective_update_active);
@@
-211,7
+211,7
@@
lmm_variable_t lmm_variable_new(lmm_system_t sys, void *id,
var->weight = weight;
var->bound = bound;
var->value = 0.0;
var->weight = weight;
var->bound = bound;
var->value = 0.0;
-
+ var->visited = sys->visited_counter - 1;
var->mu = 0.0;
var->new_mu = 0.0;
var->func_f = func_f_def;
var->mu = 0.0;
var->new_mu = 0.0;
var->func_f = func_f_def;
@@
-551,9
+551,8
@@
void lmm_solve(lmm_system_t sys)
cnst->usage = elem->value / elem->variable->weight;
make_elem_active(elem);
cnst->usage = elem->value / elem->variable->weight;
make_elem_active(elem);
- if(keep_track){
- xbt_swag_insert((elem->variable)->id, keep_track);
- }
+ if (sys->keep_track)
+ xbt_swag_insert(elem->variable->id, sys->keep_track);
}
}
XBT_DEBUG("Constraint Usage '%d' : %f", cnst->id_int, cnst->usage);
}
}
XBT_DEBUG("Constraint Usage '%d' : %f", cnst->id_int, cnst->usage);
@@
-718,13
+717,13
@@
void lmm_update_variable_weight(lmm_system_t sys, lmm_variable_t var,
xbt_swag_insert_at_head(elem, &(elem->constraint->element_set));
else
xbt_swag_insert_at_tail(elem, &(elem->constraint->element_set));
xbt_swag_insert_at_head(elem, &(elem->constraint->element_set));
else
xbt_swag_insert_at_tail(elem, &(elem->constraint->element_set));
+
+ if (i == 0)
+ lmm_update_modified_set(sys, elem->constraint);
}
if (!weight)
var->value = 0.0;
}
if (!weight)
var->value = 0.0;
- if (var->cnsts_number)
- lmm_update_modified_set(sys, var->cnsts[0].constraint);
-
XBT_OUT();
}
XBT_OUT();
}
@@
-788,7
+787,8
@@
static void lmm_update_modified_set_rec(lmm_system_t sys,
lmm_variable_t var = elem->variable;
s_lmm_element_t *cnsts = var->cnsts;
int i;
lmm_variable_t var = elem->variable;
s_lmm_element_t *cnsts = var->cnsts;
int i;
- for (i = 0; i < var->cnsts_number; i++) {
+ for (i = 0; var->visited != sys->visited_counter
+ && i < var->cnsts_number ; i++) {
if (cnsts[i].constraint != cnst
&& !xbt_swag_belongs(cnsts[i].constraint,
&sys->modified_constraint_set)) {
if (cnsts[i].constraint != cnst
&& !xbt_swag_belongs(cnsts[i].constraint,
&sys->modified_constraint_set)) {
@@
-796,6
+796,7
@@
static void lmm_update_modified_set_rec(lmm_system_t sys,
lmm_update_modified_set_rec(sys, cnsts[i].constraint);
}
}
lmm_update_modified_set_rec(sys, cnsts[i].constraint);
}
}
+ var->visited = sys->visited_counter;
}
}
}
}
@@
-816,5
+817,11
@@
static void lmm_update_modified_set(lmm_system_t sys,
*/
static void lmm_remove_all_modified_set(lmm_system_t sys)
{
*/
static void lmm_remove_all_modified_set(lmm_system_t sys)
{
+ if (++sys->visited_counter == 1) {
+ /* the counter wrapped around, reset each variable->visited */
+ lmm_variable_t var;
+ xbt_swag_foreach(var, &sys->variable_set)
+ var->visited = 0;
+ }
xbt_swag_reset(&sys->modified_constraint_set);
}
xbt_swag_reset(&sys->modified_constraint_set);
}