Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Moving surf_double_update (in surf_private.h) to double_update (in maxmin.h)
[simgrid.git] / src / include / surf / maxmin.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_H
9 #define _SURF_MAXMIN_H
10
11 #include "xbt/misc.h"
12
13 static _XBT_INLINE void double_update(double *variable, double value) 
14 {
15   *variable -= value;
16   if(*variable< 0.00001) *variable = 0.0;
17 }
18
19 typedef struct lmm_variable *lmm_variable_t;
20 typedef struct lmm_constraint *lmm_constraint_t;
21 typedef struct lmm_system *lmm_system_t;
22
23 lmm_system_t lmm_system_new(void);
24 void lmm_system_free(lmm_system_t sys);
25 void lmm_variable_disable(lmm_system_t sys, lmm_variable_t var);
26
27 lmm_constraint_t lmm_constraint_new(lmm_system_t sys, void *id,
28                                     double bound_value);
29 void lmm_constraint_shared(lmm_constraint_t cnst);
30
31 void lmm_constraint_free(lmm_system_t sys, lmm_constraint_t cnst);
32
33 lmm_variable_t lmm_variable_new(lmm_system_t sys, void *id,
34                                 double weight_value,
35                                 double bound, int number_of_constraints);
36 void lmm_variable_free(lmm_system_t sys, lmm_variable_t var);
37 double lmm_variable_getvalue(lmm_variable_t var);
38
39
40 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);
46
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);
53
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);
56
57 void *lmm_constraint_id(lmm_constraint_t cnst);
58 void *lmm_variable_id(lmm_variable_t var);
59
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,
63                                double bound);
64 void lmm_update_variable_weight(lmm_system_t sys, lmm_variable_t var,
65                                 double weight);
66 double lmm_get_variable_weight(lmm_variable_t var);
67
68 void lmm_update_constraint_bound(lmm_system_t sys, lmm_constraint_t cnst,
69                                  double bound);
70
71 int lmm_constraint_used(lmm_system_t sys, lmm_constraint_t cnst);
72
73 void lmm_solve(lmm_system_t sys);
74 #endif                          /* _SURF_MAXMIN_H */