src/work/marci/edmonds_karp_demo.cc
changeset 425 4fbe868c1fb4
parent 415 679e64913c5e
child 465 d72e56f1730d
equal deleted inserted replaced
28:7b776e2ef388 29:834b12e83cf8
    70   readDimacsMaxFlow(std::cin, G, s, t, cap);
    70   readDimacsMaxFlow(std::cin, G, s, t, cap);
    71   Timer ts;
    71   Timer ts;
    72   Graph::EdgeMap<int> flow(G); //0 flow
    72   Graph::EdgeMap<int> flow(G); //0 flow
    73   Preflow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > 
    73   Preflow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > 
    74     pre_flow_test(G, s, t, cap, flow, true);
    74     pre_flow_test(G, s, t, cap, flow, true);
       
    75   Preflow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > 
       
    76     pre_flow_ize(G, s, t, cap, flow, false);
    75   PreflowRes<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > 
    77   PreflowRes<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > 
    76     pre_flow_res(G, s, t, cap, flow, true);
    78     pre_flow_res(G, s, t, cap, flow, true);
    77   MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > 
    79   MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > 
    78     max_flow_test(G, s, t, cap, flow);
    80     max_flow_test(G, s, t, cap, flow);
    79 
    81 
    81     std::cout << "preflow ..." << std::endl;
    83     std::cout << "preflow ..." << std::endl;
    82     ts.reset();
    84     ts.reset();
    83     pre_flow_test.run();
    85     pre_flow_test.run();
    84     std::cout << "elapsed time: " << ts << std::endl;
    86     std::cout << "elapsed time: " << ts << std::endl;
    85     std::cout << "flow value: "<< pre_flow_test.flowValue() << std::endl;
    87     std::cout << "flow value: "<< pre_flow_test.flowValue() << std::endl;
       
    88   }
       
    89 
       
    90   {
       
    91     std::cout << "preflow ..." << std::endl;
       
    92     FOR_EACH_LOC(Graph::EdgeIt, e, G) flow.set(e, 0);
       
    93     ts.reset();
       
    94     pre_flow_ize.run();
       
    95     std::cout << "elapsed time: " << ts << std::endl;
       
    96     std::cout << "flow value: "<< pre_flow_ize.flowValue() << std::endl;
    86   }
    97   }
    87 
    98 
    88   {
    99   {
    89     std::cout << "wrapped preflow ..." << std::endl;
   100     std::cout << "wrapped preflow ..." << std::endl;
    90     FOR_EACH_LOC(Graph::EdgeIt, e, G) flow.set(e, 0);
   101     FOR_EACH_LOC(Graph::EdgeIt, e, G) flow.set(e, 0);