- surf_action_network_CM02_t action = NULL;
- double min = -1;
- double value;
-
- XBT_DEBUG
- ("Before share resources, the size of modified actions set is %d",
- xbt_swag_size(net_modified_set));
- net_update_action_remaining_lazy(now);
-
- lmm_solve(network_maxmin_system);
-
- 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(GENERIC_LMM_ACTION(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 (min != -1) {
- surf_action_lmm_heap_remove(net_action_heap,(surf_action_lmm_t)action);
- surf_action_lmm_heap_insert(net_action_heap,(surf_action_lmm_t)action, min, max_dur_flag ? MAX_DURATION : NORMAL);
- XBT_DEBUG("Insert at heap action(%p) min %lf now %lf", action, min,
- now);
- } else DIE_IMPOSSIBLE;
- }
-
- //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);
-
- return min;