1 /* A few tests for the maxmin library */
3 /* Authors: Arnaud Legrand */
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. */
10 #include "surf/maxmin.h"
12 #define PRINT_VAR(var) printf(#var " = %Lg\n",lmm_variable_getvalue(var));
16 /* ==l1== L2 ==L3== */
23 lmm_system_t Sys = NULL ;
24 lmm_constraint_t L1 = NULL;
25 lmm_constraint_t L2 = NULL;
26 lmm_constraint_t L3 = NULL;
28 lmm_variable_t R_1_2_3 = NULL;
29 lmm_variable_t R_1 = NULL;
30 lmm_variable_t R_2 = NULL;
31 lmm_variable_t R_3 = NULL;
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);
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);
43 lmm_expand(Sys, L1, R_1_2_3, 1.0);
44 lmm_expand(Sys, L2, R_1_2_3, 1.0);
45 lmm_expand(Sys, L3, R_1_2_3, 1.0);
47 lmm_expand(Sys, L1, R_1, 1.0);
49 lmm_expand(Sys, L2, R_2, 1.0);
51 lmm_expand(Sys, L3, R_3, 1.0);
68 lmm_update_variable_weight(R_1_2_3,.5);
82 lmm_system_t Sys = NULL ;
83 lmm_constraint_t CPU1 = NULL;
84 lmm_constraint_t CPU2 = NULL;
86 lmm_variable_t T1 = NULL;
87 lmm_variable_t T2 = NULL;
89 Sys = lmm_system_new();
90 CPU1 = lmm_constraint_new(Sys, (void *) "CPU1", 200.0);
91 CPU2 = lmm_constraint_new(Sys, (void *) "CPU2", 100.0);
93 T1 = lmm_variable_new(Sys, (void *) "T1", 1.0 , -1.0 , 1);
94 T2 = lmm_variable_new(Sys, (void *) "T2", 1.0 , -1.0 , 1);
96 lmm_expand(Sys, CPU1, T1, 1.0);
97 lmm_expand(Sys, CPU2, T2, 1.0);
110 lmm_system_free(Sys);
114 int main(int argc, char **argv)