X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d30b64ee1cb46a273b00b58ad3c97bb92157cd55..e86d75b81ebb5ecd77977170610c79d5f644675f:/src/include/surf/maxmin.h diff --git a/src/include/surf/maxmin.h b/src/include/surf/maxmin.h index 98c5f27ce5..c4ba28fada 100644 --- a/src/include/surf/maxmin.h +++ b/src/include/surf/maxmin.h @@ -10,10 +10,17 @@ #include "xbt/misc.h" #include "portable.h" + +#define MAXMIN_PRECISION 0.00001 static XBT_INLINE void double_update(double *variable, double value) { *variable -= value; - if(*variable< 0.00001) *variable = 0.0; + if(*variable< MAXMIN_PRECISION) *variable = 0.0; +} + +static XBT_INLINE int double_positive(double value) +{ + return (value>MAXMIN_PRECISION); } typedef struct lmm_variable *lmm_variable_t; @@ -36,7 +43,6 @@ XBT_PUBLIC(lmm_variable_t) lmm_variable_new(lmm_system_t sys, void *id, void lmm_variable_free(lmm_system_t sys, lmm_variable_t var); XBT_PUBLIC(double) lmm_variable_getvalue(lmm_variable_t var); - XBT_PUBLIC(void) lmm_expand(lmm_system_t sys, lmm_constraint_t cnst, lmm_variable_t var, double value); void lmm_expand_add(lmm_system_t sys, lmm_constraint_t cnst, @@ -62,18 +68,8 @@ void lmm_update(lmm_system_t sys, lmm_constraint_t cnst, void lmm_update_variable_bound(lmm_system_t sys, lmm_variable_t var, double bound); -/** \brief Add the value delta to var->df the sum of latencys. - * - * \param sys the lmm_system_t - * \param var the lmm_variable_t - * - * Add the value delta to var->df (the sum of latencys associated to the - * flow). 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 - * (delta != 0) before calling it. - * - */ -void lmm_update_variable_latency(lmm_system_t sys, lmm_variable_t var, + +XBT_PUBLIC(void) lmm_update_variable_latency(lmm_system_t sys, lmm_variable_t var, double delta); @@ -82,7 +78,7 @@ XBT_PUBLIC(void) lmm_update_variable_weight(lmm_system_t sys, lmm_variable_t var double weight); double lmm_get_variable_weight(lmm_variable_t var); -void lmm_update_constraint_bound(lmm_system_t sys, lmm_constraint_t cnst, +XBT_PUBLIC(void) lmm_update_constraint_bound(lmm_system_t sys, lmm_constraint_t cnst, double bound); int lmm_constraint_used(lmm_system_t sys, lmm_constraint_t cnst); @@ -98,4 +94,24 @@ void lagrange_solve(lmm_system_t sys); void lagrange_dicotomi_solve(lmm_system_t sys); + + +/** + * Default functions associated to the chosen protocol. When + * using the lagrangian approach. + */ + +XBT_PUBLIC(void) lmm_set_default_protocol_function(double (* func_f) (lmm_variable_t var, double x), + double (* func_fp) (lmm_variable_t var, double x), + double (* func_fpi)(lmm_variable_t var, double x)); + +double func_reno_f (lmm_variable_t var, double x); +double func_reno_fp (lmm_variable_t var, double x); +double func_reno_fpi(lmm_variable_t var, double x); + +double func_vegas_f (lmm_variable_t var, double x); +double func_vegas_fp (lmm_variable_t var, double x); +double func_vegas_fpi(lmm_variable_t var, double x); + + #endif /* _SURF_MAXMIN_H */