From 0809c8459acd6fdd7a03a076e49a5d1795ca6a00 Mon Sep 17 00:00:00 2001 From: alegrand Date: Wed, 8 Aug 2007 10:13:05 +0000 Subject: [PATCH] Cleaning file names. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@4051 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- testsuite/Makefile.am | 12 +- .../surf/{simeng_usage.c => lmm_usage.c} | 0 testsuite/surf/maxmin_usage.c | 333 ------------------ 3 files changed, 2 insertions(+), 343 deletions(-) rename testsuite/surf/{simeng_usage.c => lmm_usage.c} (100%) delete mode 100644 testsuite/surf/maxmin_usage.c diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am index b4c601d93f..38cefa96bc 100644 --- a/testsuite/Makefile.am +++ b/testsuite/Makefile.am @@ -33,11 +33,8 @@ RL_tests = \ gras/datadesc_usage SG_tests = \ - surf/maxmin_usage surf/maxmin_bench surf/simeng_usage \ + surf/maxmin_bench surf/lmm_usage \ surf/trace_usage surf/surf_usage surf/surf_usage2 -#if HAVE_SDP -# SG_tests+=surf/sdp_usage -#endif simdag_tests = simdag/sd_test @@ -62,16 +59,11 @@ xbt_graphxml_usage_LDADD= $(LDADD_SG) xbt_context_usage_LDADD= $(LDADD_SG) -surf_maxmin_usage_LDADD= $(LDADD_SG) surf_maxmin_bench_LDADD= $(LDADD_SG) -surf_simeng_usage_LDADD= $(LDADD_SG) +surf_lmm_usage_LDADD= $(LDADD_SG) surf_trace_usage_LDADD= $(LDADD_SG) surf_surf_usage_LDADD= $(LDADD_SG) surf_surf_usage2_LDADD= $(LDADD_SG) -#if HAVE_SDP -#surf_sdp_usage_LDADD= $(LDADD_SG) -#surf_sdp_bench_LDADD= $(LDADD_SG) -#endif gras_trp_tcp_client_LDADD= $(LDADD_RL) gras_trp_tcp_server_LDADD= $(LDADD_RL) diff --git a/testsuite/surf/simeng_usage.c b/testsuite/surf/lmm_usage.c similarity index 100% rename from testsuite/surf/simeng_usage.c rename to testsuite/surf/lmm_usage.c diff --git a/testsuite/surf/maxmin_usage.c b/testsuite/surf/maxmin_usage.c deleted file mode 100644 index f1bc8b69cf..0000000000 --- a/testsuite/surf/maxmin_usage.c +++ /dev/null @@ -1,333 +0,0 @@ -/* $Id$ */ - -/* A few tests for the maxmin library */ - -/* Copyright (c) 2004 Arnaud Legrand. All rights reserved. */ - -/* This program is free software; you can redistribute it and/or modify it - * under the terms of the license (GNU LGPL) which comes with this package. */ - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#include "xbt/sysdep.h" -#include "surf/maxmin.h" - -#include "xbt/log.h" -#include "xbt/module.h" -XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test,"Messages specific for surf example"); - -#define PRINT_VAR(var) DEBUG1(#var " = %g",lmm_variable_getvalue(var)); - -/* */ -/* ______ */ -/* ==l1== L2 ==L3== */ -/* ------ */ -/* */ - -typedef enum { - MAXMIN, - SDP -} method_t; - -void test1(method_t method); -void test1(method_t method) -{ - lmm_system_t Sys = NULL ; - lmm_constraint_t L1 = NULL; - lmm_constraint_t L2 = NULL; - lmm_constraint_t L3 = NULL; - - lmm_variable_t R_1_2_3 = NULL; - lmm_variable_t R_1 = NULL; - lmm_variable_t R_2 = NULL; - lmm_variable_t R_3 = NULL; - - Sys = lmm_system_new(); - L1 = lmm_constraint_new(Sys, (void *) "L1", 1.0); - L2 = lmm_constraint_new(Sys, (void *) "L2", 10.0); - L3 = lmm_constraint_new(Sys, (void *) "L3", 1.0); - - R_1_2_3 = lmm_variable_new(Sys, (void *) "R 1->2->3", 1.0 , -1.0 , 3); - R_1 = lmm_variable_new(Sys, (void *) "R 1", 1.0 , -1.0 , 1); - R_2 = lmm_variable_new(Sys, (void *) "R 2", 1.0 , -1.0 , 1); - R_3 = lmm_variable_new(Sys, (void *) "R 3", 1.0 , -1.0 , 1); - - lmm_expand(Sys, L1, R_1_2_3, 1.0); - lmm_expand(Sys, L2, R_1_2_3, 1.0); - lmm_expand(Sys, L3, R_1_2_3, 1.0); - - lmm_expand(Sys, L1, R_1, 1.0); - - lmm_expand(Sys, L2, R_2, 1.0); - - lmm_expand(Sys, L3, R_3, 1.0); - - PRINT_VAR(R_1_2_3); - PRINT_VAR(R_1); - PRINT_VAR(R_2); - PRINT_VAR(R_3); - - DEBUG0("\n"); - if(method==MAXMIN) - lmm_solve(Sys); -#ifdef HAVE_SDP - else if(method==SDP) - sdp_solve(Sys); -#endif - else - xbt_assert0(0,"Invalid method"); - - PRINT_VAR(R_1_2_3); - PRINT_VAR(R_1); - PRINT_VAR(R_2); - PRINT_VAR(R_3); -/* DEBUG0("\n"); */ - -/* lmm_update_variable_weight(Sys,R_1_2_3,.5); */ -/* lmm_solve(Sys); */ - -/* PRINT_VAR(R_1_2_3); */ -/* PRINT_VAR(R_1); */ -/* PRINT_VAR(R_2); */ -/* PRINT_VAR(R_3); */ - - lmm_system_free(Sys); -} - -void test2(method_t method); -void test2(method_t method) -{ - lmm_system_t Sys = NULL ; - lmm_constraint_t CPU1 = NULL; - lmm_constraint_t CPU2 = NULL; - - lmm_variable_t T1 = NULL; - lmm_variable_t T2 = NULL; - - Sys = lmm_system_new(); - CPU1 = lmm_constraint_new(Sys, (void *) "CPU1", 200.0); - CPU2 = lmm_constraint_new(Sys, (void *) "CPU2", 100.0); - - T1 = lmm_variable_new(Sys, (void *) "T1", 1.0 , -1.0 , 1); - T2 = lmm_variable_new(Sys, (void *) "T2", 1.0 , -1.0 , 1); - - lmm_expand(Sys, CPU1, T1, 1.0); - lmm_expand(Sys, CPU2, T2, 1.0); - - PRINT_VAR(T1); - PRINT_VAR(T2); - - DEBUG0("\n"); - if(method==MAXMIN) - lmm_solve(Sys); -#ifdef HAVE_SDP - else if(method==SDP) - sdp_solve(Sys); -#endif - else - xbt_assert0(0,"Invalid method"); - - PRINT_VAR(T1); - PRINT_VAR(T2); - - DEBUG0("\n"); - - lmm_system_free(Sys); -} - -void test3(method_t method); -void test3(method_t method) -{ - int flows=11; //flows and conexions are synonnims ? - int links=10; //topology info - - //just to be carefull - int i = 0; - int j = 0; - - double **A; - - lmm_system_t Sys = NULL ; - lmm_constraint_t *tmp_cnst = NULL; - lmm_variable_t *tmp_var = NULL; - char tmp_name[13]; - - - /*array to add the the constraints of fictiv variables */ - double B[15] = {10, 10, 10, 10, 10, 10, 10, 10, 10, 10, - 1, 1, 1, 1, 1}; - - A = (double **)calloc(links+5, sizeof(double)); - - for(i=0 ; i< links+5; i++){ - A[i] = (double *)calloc(flows+5, sizeof(double)); - - for(j=0 ; j< flows+5; j++){ - A[i][j] = 0.0; - - if(i >= links || j >= flows){ - A[i][j] = 0.0; - } - } - } - - /*matrix that store the constraints/topollogy*/ - /*double A[15][16]= - {{0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0}, - {0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0}, - {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0}, - - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1} - }; */ - - A[0][1] = 1.0; - A[0][7] = 1.0; - - A[1][1] = 1.0; - A[1][7] = 1.0; - A[1][8] = 1.0; - - A[2][1] = 1.0; - A[2][8] = 1.0; - - A[2][1] = 1.0; - A[2][8] = 1.0; - - A[3][8] = 1.0; - - A[4][0] = 1.0; - A[4][3] = 1.0; - A[4][9] = 1.0; - - A[5][0] = 1.0; - A[5][3] = 1.0; - A[5][4] = 1.0; - A[5][9] = 1.0; - - A[6][0] = 1.0; - A[6][4] = 1.0; - A[6][9] = 1.0; - A[6][10] = 1.0; - - A[7][2] = 1.0; - A[7][4] = 1.0; - A[7][6] = 1.0; - A[7][9] = 1.0; - A[7][10] = 1.0; - - A[8][2] = 1.0; - A[8][10] = 1.0; - - A[9][5] = 1.0; - A[9][6] = 1.0; - A[9][9] = 1.0; - - - A[10][11] = 1.0; - A[11][12] = 1.0; - A[12][13] = 1.0; - A[13][14] = 1.0; - A[14][15] = 1.0; - - - - - - - Sys = lmm_system_new(); - - - /* - * Creates the constraints - */ - tmp_cnst = calloc(15, sizeof(lmm_constraint_t)); - for(i=0; i<15; i++){ - sprintf(tmp_name, "C_%03d", i); - tmp_cnst[i] = lmm_constraint_new(Sys, (void *) tmp_name, B[i]); - } - - - /* - * Creates the variables - */ - tmp_var = calloc(16, sizeof(lmm_variable_t)); - for(j=0; j<16; j++){ - sprintf(tmp_name, "X_%03d", j); - tmp_var[j] = lmm_variable_new(Sys, (void *) tmp_name, 1.0, -1.0 , 15); - } - - /* - * Link constraints and variables - */ - for(i=0;i<15;i++) { - for(j=0; j<16; j++){ - if(A[i][j]){ - lmm_expand(Sys, tmp_cnst[i], tmp_var[j], 1.0); - } - } - } - - for(j=0; j<16; j++){ - PRINT_VAR(tmp_var[j]); - } - - if(method==MAXMIN) - lmm_solve(Sys); -#ifdef HAVE_SDP - else if(method==SDP) - sdp_solve(Sys); -#endif - else - xbt_assert0(0,"Invalid method"); - - for(j=0; j<16; j++){ - PRINT_VAR(tmp_var[j]); - } - - free(tmp_var); - free(tmp_cnst); - lmm_system_free(Sys); -} - -#ifdef __BORLANDC__ -#pragma argsused -#endif - -int main(int argc, char **argv) -{ - xbt_init(&argc,argv); - - DEBUG0("***** Test 1 (Max-Min) ***** \n"); - test1(MAXMIN); -#ifdef HAVE_SDP - DEBUG0("***** Test 1 (SDP) ***** \n"); - test1(SDP); -#endif - DEBUG0("***** Test 2 (Max-Min) ***** \n"); - test2(MAXMIN); -#ifdef HAVE_SDP - DEBUG0("***** Test 2 (SDP) ***** \n"); - test2(SDP); -#endif - DEBUG0("***** Test 3 (Max-Min) ***** \n"); - test3(MAXMIN); -#ifdef HAVE_SDP - DEBUG0("***** Test 3 (SDP) ***** \n"); - test3(SDP); -#endif - - return 0; -} -- 2.20.1