Grafalgo
Library of useful data structures and algorithms
/Users/jst/src/grafalgo/cpp/graphAlgorithms/maxFlo/maxFloRep.cpp
00001 // usage:
00002 //      maxFloRep method reps n m mss ec1 ec2 
00003 //
00004 // MaxFloRep repeatedly generates a random graph and computes
00005 // a maximum flow using the specified method.
00006 // Reps is the number of repetitions.
00007 // n is the number of vertices, p is the edge probability,
00008 // mss is the number of source and sink edges
00009 // ec1 is the mean edge capacity for the source/sink edges,
00010 // ec2 is the mean edge capacity of the other edges.
00011 //
00012 
00013 #include "stdinc.h"
00014 #include "Flograph.h"
00015 #include "maxCap.h"
00016 #include "capScale.h"
00017 #include "shortPath.h"
00018 #include "dinic.h"
00019 #include "dinicDtrees.h"
00020 #include "prePush.h"
00021 #include "ppFifo.h"
00022 
00023 int main(int argc, char* argv[]) {
00024         int i, reps, n, m, mss, ec1, ec2, floVal;
00025         if (argc != 8 ||
00026             sscanf(argv[2],"%d",&reps) != 1 ||
00027             sscanf(argv[3],"%d",&n) != 1 ||
00028             sscanf(argv[4],"%d",&m) != 1 ||
00029             sscanf(argv[5],"%d",&mss) != 1 ||
00030             sscanf(argv[6],"%d",&ec1) != 1 ||
00031             sscanf(argv[7],"%d",&ec2) != 1)
00032                 Util::fatal("usage: maxFloRep method reps n m mss ec1 ec2");
00033 
00034         Flograph fg(n,m,1,2); 
00035         for (i = 1; i <= reps; i++) {
00036                 fg.rgraph(n,m,mss); fg.randCapacity(ec1,ec2);
00037 
00038                 if (strcmp(argv[1],"maxCap") == 0)
00039                         maxCap(fg,floVal);
00040                 else if (strcmp(argv[1],"capScale") == 0)
00041                         capScale(fg,floVal);
00042                 else if (strcmp(argv[1],"shortPath") == 0)
00043                         shortPath(fg,floVal);
00044                 else if (strcmp(argv[1],"dinic") == 0)
00045                         dinic(fg,floVal);
00046                 else if (strcmp(argv[1],"dinicDtrees") == 0)
00047                         dinicDtrees(fg,floVal);
00048                 else if (strcmp(argv[1],"ppFifo") == 0)
00049                         ppFifo(fg,floVal,false);
00050                 else if (strcmp(argv[1],"ppFifoBatch") == 0)
00051                         ppFifo(fg,floVal,true);
00052                 else
00053                         Util::fatal("maxFloRep: undefined method");
00054         }
00055 }
 All Classes Files Functions Variables Typedefs Friends