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. */
16 #include "surf/maxmin.h"
19 XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test,"Messages specific for surf example");
21 #define PRINT_VAR(var) DEBUG1(#var " = %g\n",lmm_variable_getvalue(var));
25 /* ==l1== L2 ==L3== */
32 lmm_system_t Sys = NULL ;
33 lmm_constraint_t L1 = NULL;
34 lmm_constraint_t L2 = NULL;
35 lmm_constraint_t L3 = NULL;
37 lmm_variable_t R_1_2_3 = NULL;
38 lmm_variable_t R_1 = NULL;
39 lmm_variable_t R_2 = NULL;
40 lmm_variable_t R_3 = NULL;
42 Sys = lmm_system_new();
43 L1 = lmm_constraint_new(Sys, (void *) "L1", 1.0);
44 L2 = lmm_constraint_new(Sys, (void *) "L2", 10.0);
45 L3 = lmm_constraint_new(Sys, (void *) "L3", 1.0);
47 R_1_2_3 = lmm_variable_new(Sys, (void *) "R 1->2->3", 1.0 , -1.0 , 3);
48 R_1 = lmm_variable_new(Sys, (void *) "R 1", 1.0 , -1.0 , 1);
49 R_2 = lmm_variable_new(Sys, (void *) "R 2", 1.0 , -1.0 , 1);
50 R_3 = lmm_variable_new(Sys, (void *) "R 3", 1.0 , -1.0 , 1);
52 lmm_expand(Sys, L1, R_1_2_3, 1.0);
53 lmm_expand(Sys, L2, R_1_2_3, 1.0);
54 lmm_expand(Sys, L3, R_1_2_3, 1.0);
56 lmm_expand(Sys, L1, R_1, 1.0);
58 lmm_expand(Sys, L2, R_2, 1.0);
60 lmm_expand(Sys, L3, R_3, 1.0);
77 lmm_update_variable_weight(Sys,R_1_2_3,.5);
91 lmm_system_t Sys = NULL ;
92 lmm_constraint_t CPU1 = NULL;
93 lmm_constraint_t CPU2 = NULL;
95 lmm_variable_t T1 = NULL;
96 lmm_variable_t T2 = NULL;
98 Sys = lmm_system_new();
99 CPU1 = lmm_constraint_new(Sys, (void *) "CPU1", 200.0);
100 CPU2 = lmm_constraint_new(Sys, (void *) "CPU2", 100.0);
102 T1 = lmm_variable_new(Sys, (void *) "T1", 1.0 , -1.0 , 1);
103 T2 = lmm_variable_new(Sys, (void *) "T2", 1.0 , -1.0 , 1);
105 lmm_expand(Sys, CPU1, T1, 1.0);
106 lmm_expand(Sys, CPU2, T2, 1.0);
119 lmm_system_free(Sys);
126 int main(int argc, char **argv)
128 DEBUG0("***** Test 1 ***** \n");
130 DEBUG0("***** Test 2 ***** \n");