[Lemon-commits] [lemon_svn] hegyi: r1069 - in hugo/trunk/src: hugo test

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


Author: hegyi
Date: Tue Aug 31 15:40:07 2004
New Revision: 1069

Modified:
   hugo/trunk/src/hugo/bin_heap.h
   hugo/trunk/src/hugo/dijkstra.h
   hugo/trunk/src/hugo/mincostflows.h
   hugo/trunk/src/hugo/minlengthpaths.h
   hugo/trunk/src/test/dijkstra_heap_test.cc
   hugo/trunk/src/test/dijkstra_test.cc

Log:
minlengthpaths_test.cc is already hugo++ comform and is compilable


Modified: hugo/trunk/src/hugo/bin_heap.h
==============================================================================
--- hugo/trunk/src/hugo/bin_heap.h	(original)
+++ hugo/trunk/src/hugo/bin_heap.h	Tue Aug 31 15:40:07 2004
@@ -33,7 +33,8 @@
  * csokkentettunk-e rajta, vagy noveltunk.
  * Ehhez nagyon fontos, hogy az atadott property map inicializalva legyen
  * minden szobajovo kulcs ertekre, -1 -es ertekkel!
- * Es ilyen esetben a kulcsokrol lekerdezheto az allapotuk a state metodussal:
+ * Es ilyen esetben a kulcsokrol lekerdezheto az allapotuk a state
+ metodussal:
  * (nem jart meg a kupacban PRE_HEAP=-1, epp a kupacban van IN_HEAP=0,
  *  mar kikerult a kupacbol POST_HEAP=-2).
  * Szoval ebben a modban a kupac nagyjabol hasznalhato property_map-kent, csak

Modified: hugo/trunk/src/hugo/dijkstra.h
==============================================================================
--- hugo/trunk/src/hugo/dijkstra.h	(original)
+++ hugo/trunk/src/hugo/dijkstra.h	Tue Aug 31 15:40:07 2004
@@ -242,7 +242,6 @@
 	
 	for(OutEdgeIt e(*G,v); e!=INVALID; ++e) {
 	  Node w=G->head(e); 
-	  
 	  switch(heap.state(w)) {
 	  case HeapType::PRE_HEAP:
 	    heap.push(w,oldvalue+(*length)[e]); 

Modified: hugo/trunk/src/hugo/mincostflows.h
==============================================================================
--- hugo/trunk/src/hugo/mincostflows.h	(original)
+++ hugo/trunk/src/hugo/mincostflows.h	Tue Aug 31 15:40:07 2004
@@ -116,12 +116,12 @@
       //Resetting variables from previous runs
       total_length = 0;
       
-      FOR_EACH_LOC(typename Graph::EdgeIt, e, G){
+      for(typename Graph::EdgeIt e=loopFirst(typename Graph::EdgeIt(), (G)); e!=INVALID; ++e){
 	flow.set(e,0);
       }
 
       //Initialize the potential to zero
-      FOR_EACH_LOC(typename Graph::NodeIt, n, G){
+      for(typename Graph::NodeIt n=loopFirst(typename Graph::NodeIt(), (G)); n!=INVALID; ++n){
 	potential.set(n,0);
       }
       
@@ -144,7 +144,9 @@
 	};
 	
 	//We have to change the potential
-	FOR_EACH_LOC(typename ResGraphType::NodeIt, n, res_graph){
+        //#define FOR_EACH_LOC(Ittype, e, g) for(Ittype e=loopFirst(Ittype(), (g)); (g).valid(e); (g).next(e))
+	//FOR_EACH_LOC(typename ResGraphType::NodeIt, n, res_graph){
+        for(typename ResGraphType::NodeIt n=loopFirst(typename ResGraphType::NodeIt(), (res_graph)); n!=INVALID; ++n){
 	  potential[n] += dijkstra.distMap()[n];
 	}
 
@@ -195,7 +197,9 @@
     bool checkComplementarySlackness(){
       Length mod_pot;
       Length fl_e;
-      FOR_EACH_LOC(typename Graph::EdgeIt, e, G){
+        //#define FOR_EACH_LOC(Ittype, e, g) for(Ittype e=loopFirst(Ittype(), (g)); (g).valid(e); (g).next(e))
+        //FOR_EACH_LOC(typename Graph::EdgeIt, e, G){
+        for(typename Graph::EdgeIt e=loopFirst(typename Graph::EdgeIt(), (G)); e!=INVALID; ++e){
 	//C^{\Pi}_{i,j}
 	mod_pot = length[e]-potential[G.head(e)]+potential[G.tail(e)];
 	fl_e = flow[e];

Modified: hugo/trunk/src/hugo/minlengthpaths.h
==============================================================================
--- hugo/trunk/src/hugo/minlengthpaths.h	(original)
+++ hugo/trunk/src/hugo/minlengthpaths.h	Tue Aug 31 15:40:07 2004
@@ -83,7 +83,8 @@
       //The name here suggests that the flow has only 0/1 values.
       EdgeIntMap reversed(G); 
 
-      FOR_EACH_LOC(typename Graph::EdgeIt, e, G){
+      //FOR_EACH_LOC(typename Graph::EdgeIt, e, G){
+      for(typename Graph::EdgeIt e=loopFirst(typename Graph::EdgeIt(), (G)); e!=INVALID; ++e){
 	reversed[e] = mincost_flow.getFlow()[e];
       }
       
@@ -100,7 +101,7 @@
 	  G.first(e,n);
 	  
 	  while (!reversed[e]){
-	    G.next(e);
+	    ++e;
 	  }
 	  n = G.head(e);
 	  paths[j].push_back(e);

Modified: hugo/trunk/src/test/dijkstra_heap_test.cc
==============================================================================
--- hugo/trunk/src/test/dijkstra_heap_test.cc	(original)
+++ hugo/trunk/src/test/dijkstra_heap_test.cc	Tue Aug 31 15:40:07 2004
@@ -56,7 +56,7 @@
   int error2=0;
 
   EdgeIt e;
-  for(G.first(e); G.valid(e); G.next(e)) {
+  for(G.first(e); e!=INVALID; ++e) {
     Node u=G.tail(e);
     Node v=G.head(e);
     if ( dijkstra_test.dist(v) - dijkstra_test.dist(u) > cap[e] )
@@ -69,7 +69,7 @@
   }
 
   NodeIt v;
-  for(G.first(v); G.valid(v); G.next(v)) {
+  for(G.first(v); v!=INVALID; ++v) {
     if ( dijkstra_test.reached(v) ) {
       Edge e=dijkstra_test.pred(v);
       Node u=G.tail(e);
@@ -105,7 +105,7 @@
   error1=0;
   error2=0;
 
-  for(G.first(e); G.valid(e); G.next(e)) {
+  for(G.first(e); e!=INVALID; ++e) {
     Node u=G.tail(e);
     Node v=G.head(e);
     if ( dijkstra_test2.dist(v) - dijkstra_test2.dist(u) > cap[e] )
@@ -117,7 +117,7 @@
       }
   }
 
-  for(G.first(v); G.valid(v); G.next(v)) {
+  for(G.first(v); v!=INVALID; ++v) {
     if ( dijkstra_test2.reached(v) ) {
       Edge e=dijkstra_test2.pred(v);
       Node u=G.tail(e);

Modified: hugo/trunk/src/test/dijkstra_test.cc
==============================================================================
--- hugo/trunk/src/test/dijkstra_test.cc	(original)
+++ hugo/trunk/src/test/dijkstra_test.cc	Tue Aug 31 15:40:07 2004
@@ -75,7 +75,7 @@
   check(dijkstra_test.dist(t)==13,"Dijkstra found a wrong path.");
 
 
-  for(EdgeIt e(G); e==INVALID; ++e) {
+  for(EdgeIt e(G); e!=INVALID; ++e) {
     Node u=G.tail(e);
     Node v=G.head(e);
     check( !dijkstra_test.reached(u) ||
@@ -86,7 +86,7 @@
   }
 
   ///\bug This works only for integer lengths
-  for(NodeIt v(G); v==INVALID; ++v)
+  for(NodeIt v(G); v!=INVALID; ++v)
     if ( dijkstra_test.reached(v) ) {
       Edge e=dijkstra_test.pred(v);
       Node u=G.tail(e);



More information about the Lemon-commits mailing list