diff -r 5dc61ba30730 -r e0a80761dfd9 src/work/marci/edmonds_karp_demo.cc --- a/src/work/marci/edmonds_karp_demo.cc Thu Apr 15 19:01:00 2004 +0000 +++ b/src/work/marci/edmonds_karp_demo.cc Thu Apr 15 20:19:26 2004 +0000 @@ -9,6 +9,7 @@ #include //#include #include +#include using namespace hugo; @@ -66,59 +67,27 @@ Node s, t; Graph::EdgeMap cap(G); readDimacsMaxFlow(std::cin, G, s, t, cap); + Timer ts; + Graph::EdgeMap flow(G); //0 flow + Preflow, Graph::EdgeMap > + pre_flow_test(G, s, t, cap, flow); + MaxFlow, Graph::EdgeMap > + max_flow_test(G, s, t, cap, flow); { std::cout << "preflow ..." << std::endl; - Graph::EdgeMap flow(G); //0 flow - - Timer ts; ts.reset(); - - Preflow, Graph::EdgeMap > - max_flow_test(G, s, t, cap, flow); - max_flow_test.run(); -// int i=0; -// while (max_flow_test.augmentOnBlockingFlow()) { -// for(EdgeIt e=G.template first(); e.valid(); ++e) { -// std::cout<<"("<"<(); e.valid(); ++e) { -// std::cout<<"("<"< flow(G); //0 flow - - Timer ts; + FOR_EACH_LOC(Graph::EdgeIt, e, G) flow.set(e, 0); ts.reset(); - - MaxFlow, Graph::EdgeMap > - max_flow_test(G, s, t, cap, flow); int i=0; - while (max_flow_test.augmentOnBlockingFlow()) { -// for(EdgeIt e=G.template first(); e.valid(); ++e) { -// std::cout<<"("<"<(); e.valid(); ++e) { -// std::cout<<"("<"<()) { ++i; } std::cout << "elapsed time: " << ts << std::endl; std::cout << "number of augmentation phases: " << i << std::endl; std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl; @@ -126,27 +95,10 @@ { std::cout << "faster physical blocking flow augmentation ..." << std::endl; - Graph::EdgeMap flow(G); //0 flow - - Timer ts; + FOR_EACH_LOC(Graph::EdgeIt, e, G) flow.set(e, 0); ts.reset(); - - MaxFlow, Graph::EdgeMap > - max_flow_test(G, s, t, cap, flow); int i=0; - while (max_flow_test.augmentOnBlockingFlow1()) { -// for(EdgeIt e=G.template first(); e.valid(); ++e) { -// std::cout<<"("<"<(); e.valid(); ++e) { -// std::cout<<"("<"<()) { ++i; } std::cout << "elapsed time: " << ts << std::endl; std::cout << "number of augmentation phases: " << i << std::endl; std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl; @@ -154,27 +106,10 @@ { std::cout << "on-the-fly blocking flow augmentation ..." << std::endl; - Graph::EdgeMap flow(G); //0 flow - - Timer ts; + FOR_EACH_LOC(Graph::EdgeIt, e, G) flow.set(e, 0); ts.reset(); - - MaxFlow, Graph::EdgeMap > - max_flow_test(G, s, t, cap, flow); int i=0; - while (max_flow_test.augmentOnBlockingFlow2()) { -// for(EdgeIt e=G.template first(); e.valid(); ++e) { -// std::cout<<"("<"<(); e.valid(); ++e) { -// std::cout<<"("<"< flow(G); //0 flow - - Timer ts; + FOR_EACH_LOC(Graph::EdgeIt, e, G) flow.set(e, 0); ts.reset(); - - MaxFlow, Graph::EdgeMap > - max_flow_test(G, s, t, cap, flow); int i=0; - while (max_flow_test.augmentOnShortestPath()) { -// for(EdgeIt e=G.template first(); e.valid(); ++e) { -// std::cout<<"("<"<(); e.valid(); ++e) { -// std::cout<<"("<"<