Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Efficient linear max-minimization library : first version.
[simgrid.git] / testsuite / surf / maxmin_usage.c
1 /* A few tests for the maxmin library                                       */
2
3 /* Authors: Arnaud Legrand                                                  */
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 #include <stdlib.h>
9 #include <stdio.h>
10 #include "surf/maxmin.h"
11
12 /*                               */
13 /*        ______                 */
14 /*  ==l1==  l2  ==l3==           */
15 /*        ------                 */
16 /*                               */
17
18 void test(void);
19 void test(void)
20 {
21   lmm_system_t sys = NULL ;
22   lmm_constraint_t l1 = NULL;
23   lmm_constraint_t l2 = NULL;
24   lmm_constraint_t l3 = NULL;
25
26   lmm_variable_t r_1_2_3 = NULL;
27   lmm_variable_t r_1 = NULL;
28   lmm_variable_t r_2 = NULL;
29   lmm_variable_t r_3 = NULL;
30
31
32
33   sys = lmm_system_new();
34   l1 = lmm_constraint_new(sys, /* (void *) "L1", */ 1.0);
35   l2 = lmm_constraint_new(sys, /* (void *) "L2", */ 10.0);
36   l3 = lmm_constraint_new(sys, /* (void *) "L3", */ 1.0);
37
38   r_1_2_3 = lmm_variable_new(sys, /* (void *) "R 1->2->3", */ 1.0 , 1.0 , 3);
39   r_1 = lmm_variable_new(sys, /* (void *) "R 1", */ 1.0 , 1.0 , 1);
40   r_2 = lmm_variable_new(sys, /* (void *) "R 2", */ 1.0 , 1.0 , 1);
41   r_3 = lmm_variable_new(sys, /* (void *) "R 3", */ 1.0 , 1.0 , 1);
42
43   lmm_add_constraint(sys, l1, r_1_2_3, 1.0);
44   lmm_add_constraint(sys, l2, r_1_2_3, 1.0);
45   lmm_add_constraint(sys, l3, r_1_2_3, 1.0);
46
47   lmm_add_constraint(sys, l1, r_1, 1.0);
48
49   lmm_add_constraint(sys, l2, r_2, 1.0);
50
51   lmm_add_constraint(sys, l3, r_3, 1.0);
52
53   lmm_system_free(sys);
54
55
56
57 int main(int argc, char **argv)
58 {
59   test();
60   return 0;
61 }