X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/9b5104b79979b6fff2a0a9a22e907da22efd5ecb..24dbcb1a8071fe684d776063f04b314d92094e8d:/contrib/deployment_generation/generate_random_deployment.pl
diff --git a/contrib/deployment_generation/generate_random_deployment.pl b/contrib/deployment_generation/generate_random_deployment.pl
deleted file mode 100755
index 32476b036c..0000000000
--- a/contrib/deployment_generation/generate_random_deployment.pl
+++ /dev/null
@@ -1,140 +0,0 @@
-#!/usr/bin/perl -w
-use strict;
-
-sub melange {
- my $tableau=shift;
- my($i,$j);
-
- for($i = @$tableau ; --$i; ) {
- $j = int rand ($i+1);
- next if $i==$j;
- @$tableau[$i,$j] = @$tableau[$j,$i];
- }
-}
-
-sub read_file {
- my($filename)=shift;
- my($line);
- my(@host_list);
- open(INPUT,"$filename");
- while(defined($line=)) {
- chomp $line;
- if($line=~/host id/) {
- $line=~ s/.*host id="//;
- $line=~ s/\".*$//;
- push @host_list,$line;
- }
- }
- close(INPUT);
- return \@host_list;
-}
-
-sub generate_random_deployment{
- my($host_list,$nflows,$filename)=@_;
- my(%pairs);
- my($nhost) = scalar(@$host_list);
- my(%taken);
-
- $nflows< $nhost*$nhost-$nhost or die "Too much flows! I can't do it\n";
-
- open(OUTPUT,"> $filename");
- while(scalar(keys(%pairs))<$nflows) {
- my($src)=int(rand(scalar(@$host_list)));
- my($dst)=int(rand(scalar(@$host_list)));
-
- if($src!=$dst && !defined($pairs{"$$host_list[$src] $$host_list[$dst]"})) {
- $pairs{"$$host_list[$src] $$host_list[$dst]"}=1;
- $taken{"$$host_list[$src]"}=1;
- $taken{"$$host_list[$dst]"}=1;
-# && !$taken{$$host_list[$src]} && !$taken{$$host_list[$dst]}
- }
- }
- my($p);
-
- my($count)=0;
-
- print OUTPUT <
-
-
-EOF
-
- foreach $p (keys %pairs) {
- my($src,$dst)=split(/ /,$p);
- print OUTPUT " \n";
- print OUTPUT " \n";
- print OUTPUT " \n";
- print OUTPUT " \n";
- print OUTPUT " \n";
- print OUTPUT " \n";
- print OUTPUT " \n";
- print OUTPUT " \n";
- $count++;
- }
-
- print OUTPUT <
-EOF
- close(OUTPUT);
-}
-
-
-sub generate_random_deployment2{
- my($host_list,$nflows,$filename)=@_;
- my(%pairs);
- my($nhost) = scalar(@$host_list);
- my(%taken);
-
- melange($host_list);
- $nflows< $nhost/2 or die "Too much flows! I can't do it\n";
-
- open(OUTPUT,"> $filename");
- foreach (0..$nflows-1) {
- my($src)=shift(@$host_list);
- my($dst)=shift(@$host_list);
-
- $pairs{"$src $dst"}=1;
- }
- my($p);
-
- my($count)=0;
-
- print OUTPUT <
-
-
-EOF
-
- foreach $p (keys %pairs) {
- my($src,$dst)=split(/ /,$p);
- print OUTPUT " \n";
- print OUTPUT " \n";
- print OUTPUT " \n";
- print OUTPUT " \n";
- print OUTPUT " \n";
- print OUTPUT " \n";
- print OUTPUT " \n";
- print OUTPUT " \n";
- $count++;
- }
-
- print OUTPUT <
-EOF
- close(OUTPUT);
-}
-
-sub main {
- my($nodes,$edges,$interferences,$host_list,$count_interferences);
-
- $#ARGV>=1 or die "Need a xml platform file and a number of flows!";
- my($filename)=$ARGV[0];
- my($nflows)=$ARGV[1];
- $filename =~ s/\.xml$//g;
- $filename =~ s/-p$//g;
-
- $host_list = read_file $ARGV[0];
- generate_random_deployment2($host_list,$nflows,"$filename-d.xml");
-}
-
-main;