src/hugo/mincostflows.h
changeset 788 c3187cafcabf
parent 785 a9b0863c2265
child 860 3577b3db6089
     1.1 --- a/src/hugo/mincostflows.h	Thu Sep 02 15:30:50 2004 +0000
     1.2 +++ b/src/hugo/mincostflows.h	Thu Sep 02 16:56:33 2004 +0000
     1.3 @@ -11,7 +11,6 @@
     1.4  #include <hugo/graph_wrapper.h>
     1.5  #include <hugo/maps.h>
     1.6  #include <vector>
     1.7 -#include <hugo/for_each_macros.h>
     1.8  
     1.9  namespace hugo {
    1.10  
    1.11 @@ -116,16 +115,11 @@
    1.12        //Resetting variables from previous runs
    1.13        total_length = 0;
    1.14        
    1.15 -      for(typename Graph::EdgeIt e=loopFirst(typename Graph::EdgeIt(), (G)); e!=INVALID; ++e){
    1.16 -	flow.set(e,0);
    1.17 -      }
    1.18 +      for (typename Graph::EdgeIt e(G); e!=INVALID; ++e) flow.set(e, 0);
    1.19  
    1.20        //Initialize the potential to zero
    1.21 -      for(typename Graph::NodeIt n=loopFirst(typename Graph::NodeIt(), (G)); n!=INVALID; ++n){
    1.22 -	potential.set(n,0);
    1.23 -      }
    1.24 +      for (typename Graph::NodeIt n(G); n!=INVALID; ++n) potential.set(n, 0);
    1.25        
    1.26 -
    1.27        
    1.28        //We need a residual graph
    1.29        ResGraphType res_graph(G, capacity, flow);
    1.30 @@ -144,11 +138,8 @@
    1.31  	};
    1.32  	
    1.33  	//We have to change the potential
    1.34 -        //#define FOR_EACH_LOC(Ittype, e, g) for(Ittype e=loopFirst(Ittype(), (g)); (g).valid(e); (g).next(e))
    1.35 -	//FOR_EACH_LOC(typename ResGraphType::NodeIt, n, res_graph){
    1.36 -        for(typename ResGraphType::NodeIt n=loopFirst(typename ResGraphType::NodeIt(), (res_graph)); n!=INVALID; ++n){
    1.37 +        for(typename ResGraphType::NodeIt n(res_graph); n!=INVALID; ++n)
    1.38  	  potential[n] += dijkstra.distMap()[n];
    1.39 -	}
    1.40  
    1.41  
    1.42  	//Augmenting on the sortest path
    1.43 @@ -197,9 +188,7 @@
    1.44      bool checkComplementarySlackness(){
    1.45        Length mod_pot;
    1.46        Length fl_e;
    1.47 -        //#define FOR_EACH_LOC(Ittype, e, g) for(Ittype e=loopFirst(Ittype(), (g)); (g).valid(e); (g).next(e))
    1.48 -        //FOR_EACH_LOC(typename Graph::EdgeIt, e, G){
    1.49 -        for(typename Graph::EdgeIt e=loopFirst(typename Graph::EdgeIt(), (G)); e!=INVALID; ++e){
    1.50 +        for(typename Graph::EdgeIt e(G); e!=INVALID; ++e) {
    1.51  	//C^{\Pi}_{i,j}
    1.52  	mod_pot = length[e]-potential[G.head(e)]+potential[G.tail(e)];
    1.53  	fl_e = flow[e];