src/work/marci/max_flow_demo.cc
changeset 476 cfe550761745
parent 475 5fa75db9ebb4
child 480 4fb0d1e166ea
     1.1 --- a/src/work/marci/max_flow_demo.cc	Thu Apr 29 16:08:16 2004 +0000
     1.2 +++ b/src/work/marci/max_flow_demo.cc	Thu Apr 29 16:25:03 2004 +0000
     1.3 @@ -5,7 +5,6 @@
     1.4  #include <list_graph.h>
     1.5  #include <smart_graph.h>
     1.6  #include <dimacs.h>
     1.7 -//#include <edmonds_karp.h>
     1.8  #include <time_measure.h>
     1.9  //#include <graph_wrapper.h>
    1.10  #include <preflow.h>
    1.11 @@ -70,30 +69,24 @@
    1.12    readDimacsMaxFlow(std::cin, G, s, t, cap);
    1.13    Timer ts;
    1.14    Graph::EdgeMap<int> flow(G); //0 flow
    1.15 -  Preflow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > 
    1.16 -    pre_flow_test(G, s, t, cap, flow/*, true*/);
    1.17 -  //  Preflow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > 
    1.18 -  //  pre_flow_ize(G, s, t, cap, flow/*, false*/);
    1.19 -//   PreflowRes<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > 
    1.20 -//     pre_flow_res(G, s, t, cap, flow/*, true*/);
    1.21 -  //MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > 
    1.22 -  //  max_flow_test(G, s, t, cap, flow);
    1.23 +  MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > 
    1.24 +    max_flow_test(G, s, t, cap, flow);
    1.25  
    1.26    {
    1.27      std::cout << "preflow ..." << std::endl;
    1.28      ts.reset();
    1.29 -    pre_flow_test.run();
    1.30 +    max_flow_test.run();
    1.31      std::cout << "elapsed time: " << ts << std::endl;
    1.32 -    std::cout << "flow value: "<< pre_flow_test.flowValue() << std::endl;
    1.33 +    std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
    1.34    }
    1.35  
    1.36    {
    1.37      std::cout << "preflow ..." << std::endl;
    1.38      FOR_EACH_LOC(Graph::EdgeIt, e, G) flow.set(e, 0);
    1.39      ts.reset();
    1.40 -    pre_flow_test.preflow(Preflow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> >::GEN_FLOW);
    1.41 +    max_flow_test.preflow(MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> >::GEN_FLOW);
    1.42      std::cout << "elapsed time: " << ts << std::endl;
    1.43 -    std::cout << "flow value: "<< pre_flow_test.flowValue() << std::endl;
    1.44 +    std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
    1.45    }
    1.46  
    1.47  //   {
    1.48 @@ -110,10 +103,10 @@
    1.49      FOR_EACH_LOC(Graph::EdgeIt, e, G) flow.set(e, 0);
    1.50      ts.reset();
    1.51      int i=0;
    1.52 -    while (pre_flow_test.augmentOnBlockingFlow<MutableGraph>()) { ++i; }
    1.53 +    while (max_flow_test.augmentOnBlockingFlow<MutableGraph>()) { ++i; }
    1.54      std::cout << "elapsed time: " << ts << std::endl;
    1.55      std::cout << "number of augmentation phases: " << i << std::endl; 
    1.56 -    std::cout << "flow value: "<< pre_flow_test.flowValue() << std::endl;
    1.57 +    std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
    1.58    }
    1.59  
    1.60  //   {
    1.61 @@ -132,10 +125,10 @@
    1.62      FOR_EACH_LOC(Graph::EdgeIt, e, G) flow.set(e, 0);
    1.63      ts.reset();
    1.64      int i=0;
    1.65 -    while (pre_flow_test.augmentOnBlockingFlow2()) { ++i; }
    1.66 +    while (max_flow_test.augmentOnBlockingFlow2()) { ++i; }
    1.67      std::cout << "elapsed time: " << ts << std::endl;
    1.68      std::cout << "number of augmentation phases: " << i << std::endl; 
    1.69 -    std::cout << "flow value: "<< pre_flow_test.flowValue() << std::endl;
    1.70 +    std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
    1.71    }
    1.72  
    1.73    {
    1.74 @@ -143,10 +136,10 @@
    1.75      FOR_EACH_LOC(Graph::EdgeIt, e, G) flow.set(e, 0);
    1.76      ts.reset();
    1.77      int i=0;
    1.78 -    while (pre_flow_test.augmentOnShortestPath()) { ++i; }
    1.79 +    while (max_flow_test.augmentOnShortestPath()) { ++i; }
    1.80      std::cout << "elapsed time: " << ts << std::endl;
    1.81      std::cout << "number of augmentation phases: " << i << std::endl; 
    1.82 -    std::cout << "flow value: "<< pre_flow_test.flowValue() << std::endl;
    1.83 +    std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
    1.84    }
    1.85  
    1.86