|
SimGrid
3.13
Versatile Simulation of Distributed Systems
|
#include "xbt/sysdep.h"#include "xbt/log.h"#include "xbt/mallocator.h"#include "maxmin_private.hpp"#include <stdlib.h>#include <stdio.h>#include <math.h>Classes | |
| struct | s_dyn_light |
Macros | |
| #define | lmm_variable_mallocator_reset_f ((void_f_pvoid_t)NULL) |
Typedefs | |
| typedef struct s_dyn_light | s_dyn_light_t |
| typedef struct s_dyn_light * | dyn_light_t |
Functions | |
| XBT_LOG_NEW_DEFAULT_SUBCATEGORY (surf_maxmin, surf,"Logging specific to SURF (maxmin)") | |
| static void * | lmm_variable_mallocator_new_f (void) |
| static void | lmm_variable_mallocator_free_f (void *var) |
| static void | lmm_update_modified_set (lmm_system_t sys, lmm_constraint_t cnst) |
| static void | lmm_remove_all_modified_set (lmm_system_t sys) |
| Remove all constraints of the modified_constraint_set. More... | |
| static void | lmm_var_free (lmm_system_t sys, lmm_variable_t var) |
| static void | lmm_cnst_free (lmm_system_t sys, lmm_constraint_t cnst) |
| static void | lmm_on_disabled_var (lmm_system_t sys, lmm_constraint_t cnstr) |
| static void | lmm_enable_var (lmm_system_t sys, lmm_variable_t var) |
| static int | lmm_can_enable_var (lmm_variable_t var) |
| static void | lmm_disable_var (lmm_system_t sys, lmm_variable_t var) |
| static int | lmm_concurrency_slack (lmm_constraint_t cnstr) |
| static int | lmm_cnstrs_min_concurrency_slack (lmm_variable_t var) |
| Measure the minimum concurrency slack across all constraints where var is involved. More... | |
| static void | lmm_check_concurrency (lmm_system_t sys) |
| int | lmm_element_concurrency (lmm_element_t elem) |
| void | lmm_decrease_concurrency (lmm_element_t elem) |
| void | lmm_increase_concurrency (lmm_element_t elem) |
| lmm_system_t | lmm_system_new (int selective_update) |
| Create a new Linear MaxMim system. More... | |
| void | lmm_system_free (lmm_system_t sys) |
| Free an existing Linear MaxMin system. More... | |
| static void | lmm_variable_remove (lmm_system_t sys, lmm_variable_t var) |
| lmm_constraint_t | lmm_constraint_new (lmm_system_t sys, void *id, double bound_value) |
| Create a new Linear MaxMin constraint. More... | |
| int | lmm_constraint_concurrency_limit_get (lmm_constraint_t cnst) |
| Gets the concurrency limit for this constraint. More... | |
| void | lmm_constraint_concurrency_limit_set (lmm_constraint_t cnst, int concurrency_limit) |
| Sets the concurrency limit for this constraint. More... | |
| void | lmm_constraint_concurrency_maximum_reset (lmm_constraint_t cnst) |
| Reset the concurrency maximum for a given variable (we will update the maximum to reflect constraint evolution). More... | |
| int | lmm_constraint_concurrency_maximum_get (lmm_constraint_t cnst) |
| Get the concurrency maximum for a given variable (which reflects constraint evolution). More... | |
| void | lmm_constraint_shared (lmm_constraint_t cnst) |
| Share a constraint. More... | |
| int | lmm_constraint_sharing_policy (lmm_constraint_t cnst) |
| Return true if the constraint is shared, and false if it's FATPIPE. More... | |
| void | lmm_constraint_free (lmm_system_t sys, lmm_constraint_t cnst) |
| Free a constraint. More... | |
| lmm_variable_t | lmm_variable_new (lmm_system_t sys, void *id, double weight, double bound, int number_of_constraints) |
| Create a new Linear MaxMin variable. More... | |
| void | lmm_variable_free (lmm_system_t sys, lmm_variable_t var) |
| Free a variable. More... | |
| double | lmm_variable_getvalue (lmm_variable_t var) |
| Get the value of the variable after the last lmm solve. More... | |
| void | lmm_variable_concurrency_share_set (lmm_variable_t var, short int concurrency_share) |
| Set the concurrent share of the variable. More... | |
| double | lmm_variable_getbound (lmm_variable_t var) |
| Get the maximum value of the variable (-1.0 if no maximum value) More... | |
| void | lmm_shrink (lmm_system_t sys, lmm_constraint_t cnst, lmm_variable_t var) |
| Remove a variable from a constraint. More... | |
| void | lmm_expand (lmm_system_t sys, lmm_constraint_t cnst, lmm_variable_t var, double value) |
| Associate a variable to a constraint with a coefficient. More... | |
| void | lmm_expand_add (lmm_system_t sys, lmm_constraint_t cnst, lmm_variable_t var, double value) |
| Add value to the coefficient between a constraint and a variable or create one. More... | |
| lmm_constraint_t | lmm_get_cnst_from_var (lmm_system_t, lmm_variable_t var, int num) |
| Get the numth constraint associated to the variable. More... | |
| double | lmm_get_cnst_weight_from_var (lmm_system_t, lmm_variable_t var, int num) |
| Get the weigth of the numth constraint associated to the variable. More... | |
| int | lmm_get_number_of_cnst_from_var (lmm_system_t, lmm_variable_t var) |
| Get the number of constraint associated to a variable. More... | |
| lmm_variable_t | lmm_get_var_from_cnst (lmm_system_t, lmm_constraint_t cnst, lmm_element_t *elem) |
| Get a var associated to a constraint. More... | |
| lmm_variable_t | lmm_get_var_from_cnst_safe (lmm_system_t, lmm_constraint_t cnst, lmm_element_t *elem, lmm_element_t *nextelem, int *numelem) |
| Get a var associated to a constraint. More... | |
| void * | lmm_constraint_id (lmm_constraint_t cnst) |
| Get the data associated to a constraint. More... | |
| void * | lmm_variable_id (lmm_variable_t var) |
| Get the data associated to a variable. More... | |
| static void | saturated_constraint_set_update (double usage, int cnst_light_num, dyn_light_t saturated_constraint_set, double *min_usage) |
| static void | saturated_variable_set_update (s_lmm_constraint_light_t *cnst_light_tab, dyn_light_t saturated_constraint_set, lmm_system_t sys) |
| void | lmm_print (lmm_system_t sys) |
| Print the lmm system. More... | |
| void | lmm_solve (lmm_system_t sys) |
| Solve the lmm system. More... | |
| void | lmm_update_variable_bound (lmm_system_t sys, lmm_variable_t var, double bound) |
| Attribute the value bound to var->bound. More... | |
| void | lmm_update_variable_weight (lmm_system_t sys, lmm_variable_t var, double weight) |
| Update the weight of a variable. More... | |
| double | lmm_get_variable_weight (lmm_variable_t var) |
| Get the weight of a variable. More... | |
| void | lmm_update_constraint_bound (lmm_system_t sys, lmm_constraint_t cnst, double bound) |
| Update a constraint bound. More... | |
| int | lmm_constraint_used (lmm_system_t sys, lmm_constraint_t cnst) |
| [brief description] More... | |
| lmm_constraint_t | lmm_get_first_active_constraint (lmm_system_t sys) |
| Get the first active constraint of a system. More... | |
| lmm_constraint_t | lmm_get_next_active_constraint (lmm_system_t sys, lmm_constraint_t cnst) |
| Get the next active constraint of a constraint in a system. More... | |
| static void | lmm_update_modified_set_rec (lmm_system_t sys, lmm_constraint_t cnst) |
| Update the constraint set propagating recursively to other constraints so the system should not be entirely computed. More... | |
| double | lmm_constraint_get_usage (lmm_constraint_t cnst) |
| Returns total resource load. More... | |
Variables | |
| double | sg_maxmin_precision = 0.00001 |
| double | sg_surf_precision = 0.00001 |
| static int | Global_debug_id = 1 |
| static int | Global_const_debug_id = 1 |
| #define lmm_variable_mallocator_reset_f ((void_f_pvoid_t)NULL) |
| typedef struct s_dyn_light s_dyn_light_t |
| typedef struct s_dyn_light * dyn_light_t |
| XBT_LOG_NEW_DEFAULT_SUBCATEGORY | ( | surf_maxmin | , |
| surf | , | ||
| "Logging specific to SURF (maxmin)" | |||
| ) |
|
static |
|
static |
Remove all constraints of the modified_constraint_set.
| sys | the lmm_system_t |
|
static |
|
inlinestatic |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Measure the minimum concurrency slack across all constraints where var is involved.
| The | variable to check for |
|
static |
|
inline |
|
inline |
|
inline |
| void lmm_system_free | ( | lmm_system_t | sys | ) |
Free an existing Linear MaxMin system.
| sys | The lmm system to free |
|
inlinestatic |
| lmm_constraint_t lmm_constraint_new | ( | lmm_system_t | sys, |
| void * | id, | ||
| double | bound_value | ||
| ) |
Create a new Linear MaxMin constraint.
| sys | The system in which we add a constraint |
| id | Data associated to the constraint (e.g.: a network link) |
| bound_value | The bound value of the constraint |
| int lmm_constraint_concurrency_limit_get | ( | lmm_constraint_t | cnst | ) |
Gets the concurrency limit for this constraint.
| cnst | A constraint |
| void lmm_constraint_concurrency_limit_set | ( | lmm_constraint_t | cnst, |
| int | concurrency_limit | ||
| ) |
Sets the concurrency limit for this constraint.
| cnst | A constraint |
| concurrency_limit | The concurrency limit to use for this constraint |
| void lmm_constraint_concurrency_maximum_reset | ( | lmm_constraint_t | cnst | ) |
Reset the concurrency maximum for a given variable (we will update the maximum to reflect constraint evolution).
| cnst | A constraint |
| int lmm_constraint_concurrency_maximum_get | ( | lmm_constraint_t | cnst | ) |
Get the concurrency maximum for a given variable (which reflects constraint evolution).
| cnst | A constraint |
| void lmm_constraint_shared | ( | lmm_constraint_t | cnst | ) |
Share a constraint.
| cnst | The constraint to share |
| int lmm_constraint_sharing_policy | ( | lmm_constraint_t | cnst | ) |
Return true if the constraint is shared, and false if it's FATPIPE.
Check if a constraint is shared (shared by default)
|
inline |
Free a constraint.
| sys | The system associated to the constraint |
| cnst | The constraint to free |
| lmm_variable_t lmm_variable_new | ( | lmm_system_t | sys, |
| void * | id, | ||
| double | weight_value, | ||
| double | bound, | ||
| int | number_of_constraints | ||
| ) |
Create a new Linear MaxMin variable.
| sys | The system in which we add a constaint |
| id | Data associated to the variable (e.g.: a network communication) |
| weight_value | The weight of the variable (0.0 if not used) |
| bound | The maximum value of the variable (-1.0 if no maximum value) |
| number_of_constraints | The maximum number of constraint to associate to the variable |
| void lmm_variable_free | ( | lmm_system_t | sys, |
| lmm_variable_t | var | ||
| ) |
Free a variable.
| sys | The system associated to the variable |
| var | The variable to free |
| double lmm_variable_getvalue | ( | lmm_variable_t | var | ) |
Get the value of the variable after the last lmm solve.
| var | A variable |
| void lmm_variable_concurrency_share_set | ( | lmm_variable_t | var, |
| short int | concurrency_share | ||
| ) |
Set the concurrent share of the variable.
| var | A variable |
| concurrency_share | The new concurrency share |
| double lmm_variable_getbound | ( | lmm_variable_t | var | ) |
Get the maximum value of the variable (-1.0 if no maximum value)
| var | A variable |
| void lmm_shrink | ( | lmm_system_t | sys, |
| lmm_constraint_t | cnst, | ||
| lmm_variable_t | var | ||
| ) |
Remove a variable from a constraint.
| sys | A system |
| cnst | A constraint |
| var | The variable to remove |
| void lmm_expand | ( | lmm_system_t | sys, |
| lmm_constraint_t | cnst, | ||
| lmm_variable_t | var, | ||
| double | value | ||
| ) |
Associate a variable to a constraint with a coefficient.
| sys | A system |
| cnst | A constraint |
| var | A variable |
| value | The coefficient associated to the variable in the constraint |
| void lmm_expand_add | ( | lmm_system_t | sys, |
| lmm_constraint_t | cnst, | ||
| lmm_variable_t | var, | ||
| double | value | ||
| ) |
Add value to the coefficient between a constraint and a variable or create one.
| sys | A system |
| cnst | A constraint |
| var | A variable |
| value | The value to add to the coefficient associated to the variable in the constraint |
| lmm_constraint_t lmm_get_cnst_from_var | ( | lmm_system_t | sys, |
| lmm_variable_t | var, | ||
| int | num | ||
| ) |
Get the numth constraint associated to the variable.
| sys | The system associated to the variable (not used) |
| var | A variable |
| num | The rank of constraint we want to get |
| double lmm_get_cnst_weight_from_var | ( | lmm_system_t | sys, |
| lmm_variable_t | var, | ||
| int | num | ||
| ) |
Get the weigth of the numth constraint associated to the variable.
| sys | The system associated to the variable (not used) |
| var | A variable |
| num | The rank of constraint we want to get |
| int lmm_get_number_of_cnst_from_var | ( | lmm_system_t | sys, |
| lmm_variable_t | var | ||
| ) |
Get the number of constraint associated to a variable.
| sys | The system associated to the variable (not used) |
| var | A variable |
| lmm_variable_t lmm_get_var_from_cnst | ( | lmm_system_t | sys, |
| lmm_constraint_t | cnst, | ||
| lmm_element_t * | elem | ||
| ) |
Get a var associated to a constraint.
Get the first variable of the next variable of elem if elem is not NULL
| sys | The system associated to the variable (not used) |
| cnst | A constraint |
| elem | A element of constraint of the constraint or NULL |
| lmm_variable_t lmm_get_var_from_cnst_safe | ( | lmm_system_t | , |
| lmm_constraint_t | cnst, | ||
| lmm_element_t * | elem, | ||
| lmm_element_t * | nextelem, | ||
| int * | numelem | ||
| ) |
Get a var associated to a constraint.
Get the first variable of the next variable of elem if elem is not NULL
| cnst | A constraint |
| elem | A element of constraint of the constraint or NULL |
| nextelem | A element of constraint of the constraint or NULL, the one after elem |
| numelem | parameter representing the number of elements to go |
| void* lmm_constraint_id | ( | lmm_constraint_t | cnst | ) |
Get the data associated to a constraint.
| cnst | A constraint |
| void* lmm_variable_id | ( | lmm_variable_t | var | ) |
Get the data associated to a variable.
| var | A variable |
|
inlinestatic |
|
inlinestatic |
| void lmm_print | ( | lmm_system_t | sys | ) |
Print the lmm system.
| sys | The lmm system to print |
| void lmm_solve | ( | lmm_system_t | sys | ) |
Solve the lmm system.
| sys | The lmm system to solve |
| void lmm_update_variable_bound | ( | lmm_system_t | sys, |
| lmm_variable_t | var, | ||
| double | bound | ||
| ) |
Attribute the value bound to var->bound.
Update the bound of a variable.
| sys | the lmm_system_t |
| var | the lmm_variable_t |
| bound | the new bound to associate with var |
Makes var->bound equal to bound. Whenever this function is called a change is signed in the system. To avoid false system changing detection it is a good idea to test (bound != 0) before calling it.
| void lmm_update_variable_weight | ( | lmm_system_t | sys, |
| lmm_variable_t | var, | ||
| double | weight | ||
| ) |
Update the weight of a variable.
| sys | A system |
| var | A variable |
| weight | The new weight of the variable |
| double lmm_get_variable_weight | ( | lmm_variable_t | var | ) |
Get the weight of a variable.
| var | A variable |
| void lmm_update_constraint_bound | ( | lmm_system_t | sys, |
| lmm_constraint_t | cnst, | ||
| double | bound | ||
| ) |
Update a constraint bound.
| sys | A system |
| cnst | A constraint |
| bound | The new bound of the consrtaint |
| int lmm_constraint_used | ( | lmm_system_t | sys, |
| lmm_constraint_t | cnst | ||
| ) |
[brief description]
| sys | A system |
| cnst | A constraint |
|
inline |
Get the first active constraint of a system.
| sys | A system |
|
inline |
Get the next active constraint of a constraint in a system.
| sys | A system |
| cnst | An active constraint of the system |
|
static |
Update the constraint set propagating recursively to other constraints so the system should not be entirely computed.
| sys | the lmm_system_t |
| cnst | the lmm_constraint_t affected by the change |
A recursive algorithm to optimize the system recalculation selecting only constraints that have changed. Each constraint change is propagated to the list of constraints for each variable.
| double lmm_constraint_get_usage | ( | lmm_constraint_t | cnst | ) |
Returns total resource load.
Get the usage of the constraint after the last lmm solve.
| cnst | the lmm_constraint_t associated to the resource |
This is dead code, but we may use it later for debug/trace.
| double sg_maxmin_precision = 0.00001 |
| double sg_surf_precision = 0.00001 |
|
static |
|
static |