X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/fe3ff7182f42007abb8aa2198f2be4772b8c099f..0714dbb971a42b14418ea392844026a816f757e3:/src/include/surf/maxmin.h diff --git a/src/include/surf/maxmin.h b/src/include/surf/maxmin.h index 0f8914e9e8..b1524f553e 100644 --- a/src/include/surf/maxmin.h +++ b/src/include/surf/maxmin.h @@ -9,28 +9,42 @@ #define _SURF_MAXMIN_H #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< MAXMIN_PRECISION) *variable = 0.0; +} + +static XBT_INLINE int double_positive(double value) +{ + return (value>MAXMIN_PRECISION); +} + typedef struct lmm_variable *lmm_variable_t; typedef struct lmm_constraint *lmm_constraint_t; typedef struct lmm_system *lmm_system_t; -lmm_system_t lmm_system_new(void); -void lmm_system_free(lmm_system_t sys); +XBT_PUBLIC(lmm_system_t) lmm_system_new(void); +XBT_PUBLIC(void) lmm_system_free(lmm_system_t sys); void lmm_variable_disable(lmm_system_t sys, lmm_variable_t var); -lmm_constraint_t lmm_constraint_new(lmm_system_t sys, void *id, +XBT_PUBLIC(lmm_constraint_t) lmm_constraint_new(lmm_system_t sys, void *id, double bound_value); void lmm_constraint_shared(lmm_constraint_t cnst); void lmm_constraint_free(lmm_system_t sys, lmm_constraint_t cnst); -lmm_variable_t lmm_variable_new(lmm_system_t sys, void *id, +XBT_PUBLIC(lmm_variable_t) lmm_variable_new(lmm_system_t sys, void *id, double weight_value, double bound, int number_of_constraints); void lmm_variable_free(lmm_system_t sys, lmm_variable_t var); -double lmm_variable_getvalue(lmm_variable_t var); +XBT_PUBLIC(double) lmm_variable_getvalue(lmm_variable_t var); -void lmm_expand(lmm_system_t sys, lmm_constraint_t cnst, +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, lmm_variable_t var, double value); @@ -54,7 +68,14 @@ void lmm_update(lmm_system_t sys, lmm_constraint_t cnst, lmm_variable_t var, double value); void lmm_update_variable_bound(lmm_system_t sys, lmm_variable_t var, double bound); -void lmm_update_variable_weight(lmm_system_t sys, lmm_variable_t var, + + +void lmm_update_variable_latency(lmm_system_t sys, lmm_variable_t var, + double delta); + + + +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); @@ -63,5 +84,31 @@ void lmm_update_constraint_bound(lmm_system_t sys, lmm_constraint_t cnst, int lmm_constraint_used(lmm_system_t sys, lmm_constraint_t cnst); -void lmm_solve(lmm_system_t sys); + +XBT_PUBLIC(void) lmm_solve(lmm_system_t sys); + +#ifdef HAVE_SDP +void sdp_solve(lmm_system_t sys); +#endif /* HAVE_SDP */ + +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. + */ +double (* func_fpi_def ) (lmm_variable_t , double); + + +void lmm_set_default_protocol_functions(double (* func_fpi) (lmm_variable_t var, double x)); + +double func_reno_fpi(lmm_variable_t var, double x); + +double func_vegas_fpi(lmm_variable_t var, double x); + + #endif /* _SURF_MAXMIN_H */