3 /* A few tests for the maxmin library */
5 /* Copyright (c) 2004 Arnaud Legrand. All rights reserved. */
7 /* This program is free software; you can redistribute it and/or modify it
8 * under the terms of the license (GNU LGPL) which comes with this package. */
12 #include "surf/maxmin.h"
15 XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test,"Messages specific for surf example");
17 #define PRINT_VAR(var) DEBUG1(#var " = %g\n",lmm_variable_getvalue(var));
21 /* ==l1== L2 ==L3== */
28 lmm_system_t Sys = NULL ;
29 lmm_constraint_t L1 = NULL;
30 lmm_constraint_t L2 = NULL;
31 lmm_constraint_t L3 = NULL;
33 lmm_variable_t R_1_2_3 = NULL;
34 lmm_variable_t R_1 = NULL;
35 lmm_variable_t R_2 = NULL;
36 lmm_variable_t R_3 = NULL;
38 Sys = lmm_system_new();
39 L1 = lmm_constraint_new(Sys, (void *) "L1", 1.0);
40 L2 = lmm_constraint_new(Sys, (void *) "L2", 10.0);
41 L3 = lmm_constraint_new(Sys, (void *) "L3", 1.0);
43 R_1_2_3 = lmm_variable_new(Sys, (void *) "R 1->2->3", 1.0 , -1.0 , 3);
44 R_1 = lmm_variable_new(Sys, (void *) "R 1", 1.0 , -1.0 , 1);
45 R_2 = lmm_variable_new(Sys, (void *) "R 2", 1.0 , -1.0 , 1);
46 R_3 = lmm_variable_new(Sys, (void *) "R 3", 1.0 , -1.0 , 1);
48 lmm_expand(Sys, L1, R_1_2_3, 1.0);
49 lmm_expand(Sys, L2, R_1_2_3, 1.0);
50 lmm_expand(Sys, L3, R_1_2_3, 1.0);
52 lmm_expand(Sys, L1, R_1, 1.0);
54 lmm_expand(Sys, L2, R_2, 1.0);
56 lmm_expand(Sys, L3, R_3, 1.0);
73 lmm_update_variable_weight(Sys,R_1_2_3,.5);
87 lmm_system_t Sys = NULL ;
88 lmm_constraint_t CPU1 = NULL;
89 lmm_constraint_t CPU2 = NULL;
91 lmm_variable_t T1 = NULL;
92 lmm_variable_t T2 = NULL;
94 Sys = lmm_system_new();
95 CPU1 = lmm_constraint_new(Sys, (void *) "CPU1", 200.0);
96 CPU2 = lmm_constraint_new(Sys, (void *) "CPU2", 100.0);
98 T1 = lmm_variable_new(Sys, (void *) "T1", 1.0 , -1.0 , 1);
99 T2 = lmm_variable_new(Sys, (void *) "T2", 1.0 , -1.0 , 1);
101 lmm_expand(Sys, CPU1, T1, 1.0);
102 lmm_expand(Sys, CPU2, T2, 1.0);
115 lmm_system_free(Sys);
118 int main(int argc, char **argv)
120 DEBUG0("***** Test 1 ***** \n");
122 DEBUG0("***** Test 2 ***** \n");