Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Throw unimplemented.
[simgrid.git] / src / surf / maxmin_private_.h
1 /* Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009, 2010. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #ifndef _SURF_MAXMIN_PRIVATE_H
8 #define _SURF_MAXMIN_PRIVATE_H
9
10 #include "surf/maxmin_.h"
11 #include "xbt/swag.h"
12 #include "xbt/mallocator.h"
13
14
15
16 typedef struct lmm_element {
17   /* hookup to constraint */
18   s_xbt_swag_hookup_t element_set_hookup;
19   s_xbt_swag_hookup_t active_element_set_hookup;
20
21   lmm_constraint_t constraint;
22   lmm_variable_t variable;
23   double value;
24 } s_lmm_element_t;
25 #define make_elem_active(elem) xbt_swag_insert_at_head(elem,&(elem->constraint->active_element_set))
26 #define make_elem_inactive(elem) xbt_swag_remove(elem,&(elem->constraint->active_element_set))
27
28 typedef struct lmm_constraint_light {
29   double remaining_over_usage;
30   lmm_constraint_t cnst;
31 } s_lmm_constraint_light_t;
32
33 typedef struct lmm_constraint {
34   /* hookup to system */
35   s_xbt_swag_hookup_t constraint_set_hookup;
36   s_xbt_swag_hookup_t active_constraint_set_hookup;
37   s_xbt_swag_hookup_t modified_constraint_set_hookup;
38   s_xbt_swag_hookup_t saturated_constraint_set_hookup;
39
40   s_xbt_swag_t element_set;     /* a list of lmm_element_t */
41   s_xbt_swag_t active_element_set;      /* a list of lmm_element_t */
42   double remaining;
43   double usage;
44   double bound;
45   int shared;
46   void *id;
47   int id_int;
48   double lambda;
49   double new_lambda;
50   lmm_constraint_light_t cnst_light;
51 } s_lmm_constraint_t;
52
53 typedef struct lmm_variable {
54   /* hookup to system */
55   s_xbt_swag_hookup_t variable_set_hookup;
56   s_xbt_swag_hookup_t saturated_variable_set_hookup;
57
58   s_lmm_element_t *cnsts;
59   int cnsts_size;
60   int cnsts_number;
61   double weight;
62   double bound;
63   double value;
64   void *id;
65   int id_int;
66   unsigned visited;             /* used by lmm_update_modified_set */
67   /* \begin{For Lagrange only} */
68   double mu;
69   double new_mu;
70   double (*func_f) (struct lmm_variable * var, double x);       /* (f)    */
71   double (*func_fp) (struct lmm_variable * var, double x);      /* (f')    */
72   double (*func_fpi) (struct lmm_variable * var, double x);     /* (f')^{-1}    */
73   /* \end{For Lagrange only} */
74 } s_lmm_variable_t;
75
76 typedef struct lmm_system {
77   int modified;
78   int selective_update_active;  /* flag to update partially the system only selecting changed portions */
79   unsigned visited_counter;     /* used by lmm_update_modified_set */
80   s_xbt_swag_t variable_set;    /* a list of lmm_variable_t */
81   s_xbt_swag_t constraint_set;  /* a list of lmm_constraint_t */
82
83   s_xbt_swag_t active_constraint_set;   /* a list of lmm_constraint_t */
84   s_xbt_swag_t modified_constraint_set; /* a list of modified lmm_constraint_t */
85
86   s_xbt_swag_t saturated_variable_set;  /* a list of lmm_variable_t */
87   s_xbt_swag_t saturated_constraint_set;        /* a list of lmm_constraint_t_t */
88
89   xbt_swag_t keep_track;
90
91   xbt_mallocator_t variable_mallocator;
92 } s_lmm_system_t;
93
94 #define extract_variable(sys) xbt_swag_extract(&(sys->variable_set))
95 #define extract_constraint(sys) xbt_swag_extract(&(sys->constraint_set))
96 #define insert_constraint(sys,cnst) xbt_swag_insert(cnst,&(sys->constraint_set))
97 #define remove_variable(sys,var) do {xbt_swag_remove(var,&(sys->variable_set));\
98                                  xbt_swag_remove(var,&(sys->saturated_variable_set));} while(0)
99 #define remove_constraint(sys,cnst) do {xbt_swag_remove(cnst,&(sys->constraint_set));\
100                                         xbt_swag_remove(cnst,&(sys->saturated_constraint_set));} while(0)
101 #define make_constraint_active(sys,cnst) xbt_swag_insert(cnst,&(sys->active_constraint_set))
102 #define make_constraint_inactive(sys,cnst) \
103   do { xbt_swag_remove(cnst, &sys->active_constraint_set);              \
104     xbt_swag_remove(cnst, &sys->modified_constraint_set); } while (0)
105
106 void lmm_print(lmm_system_t sys);
107
108 extern double (*func_f_def) (lmm_variable_t, double);
109 extern double (*func_fp_def) (lmm_variable_t, double);
110 extern double (*func_fpi_def) (lmm_variable_t, double);
111
112 #endif                          /* _SURF_MAXMIN_PRIVATE_H */