diff -r ee5959aa4410 -r c280de819a73 src/work/jacint/preflow_excess_test.cc --- a/src/work/jacint/preflow_excess_test.cc Sun Apr 17 18:57:22 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,179 +0,0 @@ -/* -The only difference between preflow.h and preflow_res.h is that the latter -uses the ResGraphWrapper, while the first does not. (Bfs is implemented by -hand in both.) This test program runs Preflow and PreflowRes on the same -graph, tests the result of these implementations and writes the running time -of them. */ -#include - -#include -#include -#include -#include - -using namespace lemon; - -int main(int, char **) { - - typedef SmartGraph Graph; - - typedef Graph::Node Node; - typedef Graph::EdgeIt EdgeIt; - - Graph G; - Node s, t; - Graph::EdgeMap cap(G); - readDimacsMaxFlow(std::cin, G, s, t, cap); - Timer ts; - - std::cout << - "\n Are we slower?" - < flow(G,0); - Preflow max_flow_test(G, s, t, cap, flow, 0 , 0); - ts.reset(); - max_flow_test.run(); - std::cout << "Elapsed time from a preflow: " << std::endl - < mincut(G); - max_flow_test.minMinCut(mincut); - int min_min_cut_value=0; - EdgeIt e; - for(G.first(e); G.valid(e); G.next(e)) { - if (mincut[G.source(e)] && !mincut[G.target(e)]) min_min_cut_value+=cap[e]; - } - - Graph::NodeMap cut(G); - max_flow_test.minCut(cut); - int min_cut_value=0; - for(G.first(e); G.valid(e); G.next(e)) { - if (cut[G.source(e)] && !cut[G.target(e)]) - min_cut_value+=cap[e]; - } - - Graph::NodeMap maxcut(G); - max_flow_test.maxMinCut(maxcut); - int max_min_cut_value=0; - for(G.first(e); G.valid(e); G.next(e)) { - if (maxcut[G.source(e)] && !maxcut[G.target(e)]) - max_min_cut_value+=cap[e]; - } - - std::cout << "\n Checking the result: " < flow2(G,0); - Preflow max_flow_test2(G, s, t, cap, flow2, 0 , 1); - ts.reset(); - max_flow_test2.run(); - std::cout << "Elapsed time from a flow: " << std::endl - << ts << std::endl; - - Graph::NodeMap mincut2(G); - max_flow_test2.minMinCut(mincut2); - int min_min_cut_value2=0; - for(G.first(e); G.valid(e); G.next(e)) { - if (mincut2[G.source(e)] && !mincut2[G.target(e)]) min_min_cut_value2+=cap[e]; - } - - Graph::NodeMap cut2(G); - max_flow_test2.minCut(cut2); - int min_cut_value2=0; - for(G.first(e); G.valid(e); G.next(e)) { - if (cut2[G.source(e)] && !cut2[G.target(e)]) - min_cut_value2+=cap[e]; - } - - Graph::NodeMap maxcut2(G); - max_flow_test2.maxMinCut(maxcut2); - int max_min_cut_value2=0; - for(G.first(e); G.valid(e); G.next(e)) { - if (maxcut2[G.source(e)] && !maxcut2[G.target(e)]) - max_min_cut_value2+=cap[e]; - } - - std::cout << "\n Checking the result: " < flow3(G,0); - Preflow max_flow_test3(G, s, t, cap, flow3, 1 , 1); - ts.reset(); - max_flow_test3.run(); - std::cout << "Elapsed time from a const zero flow: " << std::endl - < mincut3(G); - max_flow_test3.minMinCut(mincut3); - int min_min_cut_value3=0; - for(G.first(e); G.valid(e); G.next(e)) { - if (mincut3[G.source(e)] && !mincut3[G.target(e)]) min_min_cut_value3+=cap[e]; - } - - Graph::NodeMap cut3(G); - max_flow_test3.minCut(cut3); - int min_cut_value3=0; - for(G.first(e); G.valid(e); G.next(e)) { - if (cut3[G.source(e)] && !cut3[G.target(e)]) - min_cut_value3+=cap[e]; - } - - Graph::NodeMap maxcut3(G); - max_flow_test3.maxMinCut(maxcut3); - int max_min_cut_value3=0; - for(G.first(e); G.valid(e); G.next(e)) { - if (maxcut3[G.source(e)] && !maxcut3[G.target(e)]) - max_min_cut_value3+=cap[e]; - } - - std::cout << "\n Checking the result: " <