# HG changeset patch # User jacint # Date 1090333884 0 # Node ID 665689d86225cca6cdb838ff0036a4a14b4c9bca # Parent 1040693360391f9fa05a10a47ed649b9616dfdd0 trying if without stl stack we are faster diff -r 104069336039 -r 665689d86225 src/work/jacint/makefile --- a/src/work/jacint/makefile Tue Jul 20 14:29:16 2004 +0000 +++ b/src/work/jacint/makefile Tue Jul 20 14:31:24 2004 +0000 @@ -1,3 +1,3 @@ -BINARIES = max_matching -INCLUDEDIRS= -I../../include -I.. -I../{klao,marci,jacint,alpar,johanna,akos} +BINARIES = max_flow_test +INCLUDEDIRS= -I../../include -I../.. -I.. -I../{klao,marci,jacint,alpar,johanna,akos} include ../makefile diff -r 104069336039 -r 665689d86225 src/work/jacint/max_flow_test.cc --- a/src/work/jacint/max_flow_test.cc Tue Jul 20 14:29:16 2004 +0000 +++ b/src/work/jacint/max_flow_test.cc Tue Jul 20 14:31:24 2004 +0000 @@ -1,9 +1,10 @@ #include -#include -#include +#include +#include #include -#include +#include +#include using namespace hugo; @@ -25,15 +26,22 @@ G.nodeNum() << " nodes and " << G.edgeNum() << " edges..." << std::endl< flow(G,0); - MaxFlow max_flow_test(G, s, t, cap, flow); + Graph::EdgeMap flowstack(G,0); + MaxFlow max_flow_test(G, s, t, cap, flowstack); ts.reset(); max_flow_test.run(); - std::cout << "Elapsed time of run(): " << std::endl + std::cout << "Elapsed time of run() with stl stack: " << std::endl + < flow(G,0); + MaxFlowNoStack max_flow_test_no_stack(G, s, t, cap, flow); + ts.reset(); + max_flow_test_no_stack.run(); + std::cout << "Elapsed time of run() without stack: " << std::endl < mincut(G); - max_flow_test.minMinCut(mincut); + max_flow_test_no_stack.minMinCut(mincut); int min_min_cut_value=0; EdgeIt e; for(G.first(e); G.valid(e); G.next(e)) { @@ -41,7 +49,7 @@ } Graph::NodeMap cut(G); - max_flow_test.minCut(cut); + max_flow_test_no_stack.minCut(cut); int min_cut_value=0; for(G.first(e); G.valid(e); G.next(e)) { if (cut[G.tail(e)] && !cut[G.head(e)]) @@ -49,26 +57,26 @@ } Graph::NodeMap maxcut(G); - max_flow_test.maxMinCut(maxcut); + max_flow_test_no_stack.maxMinCut(maxcut); int max_min_cut_value=0; for(G.first(e); G.valid(e); G.next(e)) { if (maxcut[G.tail(e)] && !maxcut[G.head(e)]) max_min_cut_value+=cap[e]; } - std::cout << "\n Checking the result: " < flow2(G,0); std::cout << "Calling resetFlow() " << std::endl @@ -152,6 +160,7 @@ min_cut_value3 == min_min_cut_value3 && min_min_cut_value3 == max_min_cut_value3 ) std::cout << "They are equal! " <