Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use doxygen's section instead of my poor approximation; link to the list of all exist...
[simgrid.git] / src / surf / maxmin_private.h
1 /*      $Id$     */
2
3 /* Copyright (c) 2004 Arnaud Legrand. All rights reserved.                  */
4
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. */
7
8 #ifndef _SURF_MAXMIN_PRIVATE_H
9 #define _SURF_MAXMIN_PRIVATE_H
10
11 #include "surf/maxmin.h"
12 #include "xbt/swag.h"
13
14 typedef struct lmm_element {
15   /* hookup to constraint */
16   s_xbt_swag_hookup_t element_set_hookup;
17   s_xbt_swag_hookup_t active_element_set_hookup;
18
19   lmm_constraint_t constraint;
20   lmm_variable_t variable;
21   double value;
22 } s_lmm_element_t, *lmm_element_t;
23 #define make_elem_active(elem) xbt_swag_insert_at_head(elem,&(elem->constraint->active_element_set))
24 #define make_elem_inactive(elem) xbt_swag_remove(elem,&(elem->constraint->active_element_set))
25
26 typedef struct lmm_constraint {
27   /* hookup to system */
28   s_xbt_swag_hookup_t constraint_set_hookup;
29   s_xbt_swag_hookup_t active_constraint_set_hookup;
30   s_xbt_swag_hookup_t saturated_constraint_set_hookup;
31
32   s_xbt_swag_t element_set;     /* a list of lmm_mat_element_t */
33   s_xbt_swag_t active_element_set;      /* a list of lmm_mat_element_t */
34   double bound;
35   double remaining;
36   double usage;
37   void *id;
38 } s_lmm_constraint_t;
39
40 typedef struct lmm_variable {
41   /* hookup to system */
42   s_xbt_swag_hookup_t variable_set_hookup;
43   s_xbt_swag_hookup_t saturated_variable_set_hookup;
44
45   s_lmm_element_t *cnsts;
46   int cnsts_size;
47   int cnsts_number;
48   double weight;
49   double bound;
50   double value;
51   void *id;
52 } s_lmm_variable_t;
53
54 typedef struct lmm_system {
55   int modified;
56   s_xbt_swag_t variable_set;    /* a list of lmm_variable_t */
57   s_xbt_swag_t constraint_set;  /* a list of lmm_constraint_t */
58
59   s_xbt_swag_t active_constraint_set;   /* a list of lmm_constraint_t */
60
61   s_xbt_swag_t saturated_variable_set;  /* a list of lmm_variable_t */
62   s_xbt_swag_t saturated_constraint_set;        /* a list of lmm_constraint_t_t */
63 } s_lmm_system_t;
64
65 #define extract_variable(sys) xbt_swag_remove(xbt_swag_getFirst(&(sys->variable_set)),&(sys->variable_set))
66 #define extract_constraint(sys) xbt_swag_remove(xbt_swag_getFirst(&(sys->constraint_set)),&(sys->constraint_set))
67 #define insert_constraint(sys,cnst) xbt_swag_insert(cnst,&(sys->constraint_set))
68 #define remove_variable(sys,var) do {xbt_swag_remove(var,&(sys->variable_set));\
69                                  xbt_swag_remove(var,&(sys->saturated_variable_set));} while(0)
70 #define remove_constraint(sys,cnst) do {xbt_swag_remove(cnst,&(sys->constraint_set));\
71                                         xbt_swag_remove(cnst,&(sys->saturated_constraint_set));} while(0)
72 #define remove_active_constraint(sys,cnst) xbt_swag_remove(cnst,&(sys->active_constraint_set))
73 #define make_constraint_active(sys,cnst) xbt_swag_insert(cnst,&(sys->active_constraint_set))
74 #define make_constraint_inactive(sys,cnst) remove_active_constraint(sys,cnst)
75
76 static void lmm_var_free(lmm_system_t sys, lmm_variable_t var);
77 static void lmm_cnst_free(lmm_system_t sys, lmm_constraint_t cnst);
78
79 #endif                          /* _SURF_MAXMIN_PRIVATE_H */