3 /* Copyright (c) 2004 Arnaud Legrand. All rights reserved. */
5 /* This program is free software; you can redistribute it and/or modify it
6 * under the terms of the license (GNU LGPL) which comes with this package. */
13 static XBT_INLINE void double_update(double *variable, double value)
16 if(*variable< 0.00001) *variable = 0.0;
19 typedef struct lmm_variable *lmm_variable_t;
20 typedef struct lmm_constraint *lmm_constraint_t;
21 typedef struct lmm_system *lmm_system_t;
23 XBT_PUBLIC(lmm_system_t) lmm_system_new(void);
24 XBT_PUBLIC(void) lmm_system_free(lmm_system_t sys);
25 void lmm_variable_disable(lmm_system_t sys, lmm_variable_t var);
27 XBT_PUBLIC(lmm_constraint_t) lmm_constraint_new(lmm_system_t sys, void *id,
29 void lmm_constraint_shared(lmm_constraint_t cnst);
31 void lmm_constraint_free(lmm_system_t sys, lmm_constraint_t cnst);
33 XBT_PUBLIC(lmm_variable_t) lmm_variable_new(lmm_system_t sys, void *id,
35 double bound, int number_of_constraints);
36 void lmm_variable_free(lmm_system_t sys, lmm_variable_t var);
37 XBT_PUBLIC(double) lmm_variable_getvalue(lmm_variable_t var);
40 XBT_PUBLIC(void) lmm_expand(lmm_system_t sys, lmm_constraint_t cnst,
41 lmm_variable_t var, double value);
42 void lmm_expand_add(lmm_system_t sys, lmm_constraint_t cnst,
43 lmm_variable_t var, double value);
44 void lmm_elem_set_value(lmm_system_t sys, lmm_constraint_t cnst,
45 lmm_variable_t var, double value);
47 lmm_constraint_t lmm_get_cnst_from_var(lmm_system_t sys,
48 lmm_variable_t var, int num);
49 int lmm_get_number_of_cnst_from_var(lmm_system_t sys, lmm_variable_t var);
50 lmm_variable_t lmm_get_var_from_cnst(lmm_system_t sys,
51 lmm_constraint_t cnst,
52 lmm_variable_t * var);
54 lmm_constraint_t lmm_get_first_active_constraint(lmm_system_t sys);
55 lmm_constraint_t lmm_get_next_active_constraint(lmm_system_t sys, lmm_constraint_t cnst);
57 void *lmm_constraint_id(lmm_constraint_t cnst);
58 void *lmm_variable_id(lmm_variable_t var);
60 void lmm_update(lmm_system_t sys, lmm_constraint_t cnst,
61 lmm_variable_t var, double value);
62 void lmm_update_variable_bound(lmm_system_t sys, lmm_variable_t var,
65 /** \brief Add the value delta to var->df the sum of latencys.
67 * \param sys the lmm_system_t
68 * \param var the lmm_variable_t
70 * Add the value delta to var->df (the sum of latencys associated to the
71 * flow). Whenever this function is called a change is signed in the system. To
72 * avoid false system changing detection it is a good idea to test
73 * (delta != 0) before calling it.
76 void lmm_update_variable_latency(lmm_system_t sys, lmm_variable_t var,
81 XBT_PUBLIC(void) lmm_update_variable_weight(lmm_system_t sys, lmm_variable_t var,
83 double lmm_get_variable_weight(lmm_variable_t var);
85 void lmm_update_constraint_bound(lmm_system_t sys, lmm_constraint_t cnst,
88 int lmm_constraint_used(lmm_system_t sys, lmm_constraint_t cnst);
91 XBT_PUBLIC(void) lmm_solve(lmm_system_t sys);
94 void sdp_solve(lmm_system_t sys);
97 void lagrange_solve(lmm_system_t sys);
99 void lagrange_dicotomi_solve(lmm_system_t sys);
101 #endif /* _SURF_MAXMIN_H */