#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< 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;
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,
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);
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);
XBT_PUBLIC(void) lmm_solve(lmm_system_t sys);
#ifdef HAVE_SDP
-void sdp_solve(lmm_system_t sys);
+XBT_PUBLIC(void) sdp_solve(lmm_system_t sys);
#endif /* HAVE_SDP */
-void lagrange_solve(lmm_system_t sys);
+XBT_PUBLIC(void) lagrange_solve(lmm_system_t sys);
+XBT_PUBLIC(void) bottleneck_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));
+
+XBT_PUBLIC(double func_reno_f) (lmm_variable_t var, double x);
+XBT_PUBLIC(double func_reno_fp) (lmm_variable_t var, double x);
+XBT_PUBLIC(double func_reno_fpi)(lmm_variable_t var, double x);
+
+XBT_PUBLIC(double func_vegas_f) (lmm_variable_t var, double x);
+XBT_PUBLIC(double func_vegas_fp) (lmm_variable_t var, double x);
+XBT_PUBLIC(double func_vegas_fpi)(lmm_variable_t var, double x);
-void lagrange_dicotomi_solve(lmm_system_t sys);
#endif /* _SURF_MAXMIN_H */