Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
9f9002cee0ed1128287ec4515bcafbdf634abe16
[simgrid.git] / src / surf / maxmin_private.h
1 /* Authors: Arnaud Legrand                                                  */
2
3 /* This program is free software; you can redistribute it and/or modify it
4    under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #include "surf/maxmin.h"
7 #include "xbt/swag.h"
8
9 typedef struct lmm_element {
10   s_xbt_swag_hookup_t element_set_hookup;
11   lmm_constraint_t constraint;
12   FLOAT value;
13 } s_lmm_element_t, *lmm_element_t;
14 #define insert_elem_in_constraint(elem) xbt_swag_insert(elem,&(elem->constraint->element_set))
15
16 typedef struct lmm_constraint {
17   s_xbt_swag_hookup_t constraint_set_hookup;
18   /*   void *id; */
19   s_xbt_swag_t element_set;     /* a list of lmm_mat_element_t */
20   FLOAT bound;
21   FLOAT usage;
22 } s_lmm_constraint_t;
23
24 typedef struct lmm_variable {
25   s_xbt_swag_hookup_t variable_set_hookup;
26   /*   void *id; */
27   s_lmm_element_t *cnsts;
28   int cnsts_size;
29   int cnsts_number;
30   FLOAT weight_value;
31   FLOAT bound;
32   FLOAT value;
33 } s_lmm_variable_t;
34
35 typedef struct lmm_system {
36   s_xbt_swag_t variable_set;    /* a list of lmm_variable_t */
37   s_xbt_swag_t constraint_set;  /* a list of lmm_constraint_t */
38
39   s_xbt_swag_t active_constraint_set;   /* a list of lmm_constraint_t */
40 } s_lmm_system_t;
41
42 #define extract_variable(sys) xbt_swag_extract(xbt_swag_getFirst(&(sys->variable_set)),&(sys->variable_set))
43 #define extract_constraint(sys) xbt_swag_extract(xbt_swag_getFirst(&(sys->constraint_set)),&(sys->constraint_set))
44 #define insert_variable(sys,var) xbt_swag_insert(var,&(sys->variable_set))
45 #define insert_constraint(sys,cnst) xbt_swag_insert(cnst,&(sys->constraint_set))
46 #define remove_variable(sys,var) xbt_swag_extract(var,&(sys->variable_set))
47 #define remove_constraint(sys,cnst) xbt_swag_extract(cnst,&(sys->constraint_set))
48
49 static void lmm_var_free(lmm_variable_t e);
50 static void lmm_cnst_free(lmm_constraint_t cnst);
51
52 /* #define UNDEFINED_VALUE -1.0 */
53 #define UNUSED_CONSTRAINT -2.0