diff -r b2acba449222 -r e6a156fc186d src/work/jacint/preflow.cc --- a/src/work/jacint/preflow.cc Thu Apr 22 13:59:37 2004 +0000 +++ b/src/work/jacint/preflow.cc Thu Apr 22 14:11:28 2004 +0000 @@ -1,43 +1,35 @@ #include -#include #include #include #include -#include +#include #include using namespace hugo; -// Use a DIMACS max flow file as stdin. -// read_dimacs_demo < dimacs_max_flow_file int main(int, char **) { - typedef SmartGraph::Node Node; - typedef SmartGraph::EdgeIt EdgeIt; + + typedef SmartGraph Graph; + + typedef Graph::Node Node; + typedef Graph::EdgeIt EdgeIt; - SmartGraph G; + Graph G; Node s, t; - SmartGraph::EdgeMap cap(G); + Graph::EdgeMap cap(G); readDimacsMaxFlow(std::cin, G, s, t, cap); - + Timer ts; + std::cout << "preflow demo ..." << std::endl; - double mintime=1000000; - - for ( int i=1; i!=11; ++i ) { - SmartGraph::EdgeMap flow(G); - double pre_time=currTime(); - Preflow max_flow_test(G, s, t, cap, flow); - max_flow_test.run(); - double post_time=currTime(); - if ( mintime > post_time-pre_time ) mintime = post_time-pre_time; - } - - SmartGraph::EdgeMap flow(G); - Preflow max_flow_test(G, s, t, cap, flow); + Graph::EdgeMap flow(G); + Preflow max_flow_test(G, s, t, cap, flow, 1); + ts.reset(); max_flow_test.run(); + std::cout << "elapsed time: " << ts << std::endl; - SmartGraph::NodeMap cut(G); + Graph::NodeMap cut(G); max_flow_test.minCut(cut); int min_cut_value=0; EdgeIt e; @@ -45,7 +37,7 @@ if (cut[G.tail(e)] && !cut[G.head(e)]) min_cut_value+=cap[e]; } - SmartGraph::NodeMap cut1(G); + Graph::NodeMap cut1(G); max_flow_test.minMinCut(cut1); int min_min_cut_value=0; for(G.first(e); G.valid(e); G.next(e)) { @@ -53,7 +45,7 @@ min_min_cut_value+=cap[e]; } - SmartGraph::NodeMap cut2(G); + Graph::NodeMap cut2(G); max_flow_test.maxMinCut(cut2); int max_min_cut_value=0; for(G.first(e); G.valid(e); G.next(e)) { @@ -61,7 +53,6 @@ max_min_cut_value+=cap[e]; } - std::cout << "min time of 10 runs: " << mintime << " sec"<< std::endl; std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl; std::cout << "min cut value: "<< min_cut_value << std::endl; std::cout << "min min cut value: "<< min_min_cut_value << std::endl;