[Lemon-commits] [lemon_svn] jacint: r967 - hugo/trunk/src/work/jacint

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:42:28 CET 2006


Author: jacint
Date: Tue Jul 20 16:31:24 2004
New Revision: 967

Modified:
   hugo/trunk/src/work/jacint/makefile
   hugo/trunk/src/work/jacint/max_flow_test.cc

Log:
trying if without stl stack we are faster 


Modified: hugo/trunk/src/work/jacint/makefile
==============================================================================
--- hugo/trunk/src/work/jacint/makefile	(original)
+++ hugo/trunk/src/work/jacint/makefile	Tue Jul 20 16:31:24 2004
@@ -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 

Modified: hugo/trunk/src/work/jacint/max_flow_test.cc
==============================================================================
--- hugo/trunk/src/work/jacint/max_flow_test.cc	(original)
+++ hugo/trunk/src/work/jacint/max_flow_test.cc	Tue Jul 20 16:31:24 2004
@@ -1,9 +1,10 @@
 #include <iostream>
 
-#include <list_graph.h>
-#include <dimacs.h>
+#include <hugo/list_graph.h>
+#include <hugo/dimacs.h>
 #include <max_flow.h>
-#include <time_measure.h>
+#include <max_flow_no_stack.h>
+#include <hugo/time_measure.h>
 
 using namespace hugo;
 
@@ -25,15 +26,22 @@
     G.nodeNum() << " nodes and " << G.edgeNum() << " edges..."
 	   << std::endl<<std::endl;
 
-  Graph::EdgeMap<int> flow(G,0);
-  MaxFlow<Graph, int> max_flow_test(G, s, t, cap, flow);
+  Graph::EdgeMap<int> flowstack(G,0);
+  MaxFlow<Graph, int> 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 
+	    <<ts << std::endl;
+
+  Graph::EdgeMap<int> flow(G,0);
+  MaxFlowNoStack<Graph, int> 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 
 	    <<ts << std::endl;
   
   Graph::NodeMap<bool> 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<bool> 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<bool> 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: " <<std::endl;  
-  std::cout << "Flow value: "<< max_flow_test.flowValue() << std::endl;
+  std::cout << "\n Checking the result without stack: " <<std::endl;  
+  std::cout << "Flow value: "<< max_flow_test_no_stack.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;
   std::cout << "Max min cut value: "<< max_min_cut_value << 
     std::endl;
 
-  if ( max_flow_test.flowValue() == min_cut_value &&
+  if ( max_flow_test_no_stack.flowValue() == min_cut_value &&
        min_cut_value == min_min_cut_value &&
        min_min_cut_value == max_min_cut_value )
     std::cout << "They are equal! " <<std::endl<< std::endl<<"\n";  
 
-
+  /*
 
   Graph::EdgeMap<int> 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! " <<std::endl<< std::endl<<"\n";  
+  */
   
   return 0;
 }



More information about the Lemon-commits mailing list