+ XBT_DEBUG
+ ("After share resources, The size of modified actions set is %d",
+ xbt_swag_size(net_modified_set));
+
+ xbt_swag_foreach(action, net_modified_set) {
+ int max_dur_flag = 0;
+
+ if (GENERIC_ACTION(action).state_set !=
+ surf_network_model->states.running_action_set) {
+ continue;
+ }
+
+ /* bogus priority, skip it */
+ if (GENERIC_ACTION(action).priority <= 0) {
+ continue;
+ }
+
+ min = -1;
+ value = lmm_variable_getvalue(action->variable);
+ if (value > 0) {
+ if (GENERIC_ACTION(action).remains > 0) {
+ value = GENERIC_ACTION(action).remains / value;
+ min = now + value;
+ } else {
+ value = 0.0;
+ min = now;
+ }
+ }
+
+ if ((GENERIC_ACTION(action).max_duration != NO_MAX_DURATION)
+ && (min == -1
+ || GENERIC_ACTION(action).start +
+ GENERIC_ACTION(action).max_duration < min)) {
+ min = GENERIC_ACTION(action).start +
+ GENERIC_ACTION(action).max_duration;
+ max_dur_flag = 1;
+ }
+
+ XBT_DEBUG("Action(%p) Start %lf Finish %lf Max_duration %lf", action,
+ GENERIC_ACTION(action).start, now + value,
+ GENERIC_ACTION(action).max_duration);
+
+ if (action->index_heap >= 0) {
+ heap_remove((surf_action_network_CM02_t) action);
+ }
+
+ if (min != -1) {
+ heap_insert((surf_action_network_CM02_t) action, min,
+ max_dur_flag ? MAX_DURATION : NORMAL);
+ XBT_DEBUG("Insert at heap action(%p) min %lf now %lf", action, min,
+ now);
+ }
+ }
+
+ //hereafter must have already the min value for this resource model
+ if (xbt_heap_size(net_action_heap) > 0) {
+ min = xbt_heap_maxkey(net_action_heap) - now;
+ } else {
+ min = -1;
+ }
+
+ XBT_DEBUG("The minimum with the HEAP %lf", min);