nem irunk olyat hogy "void resetTarget(const Node _t) {t=_t;}" mert az a const az ott jobbara hulyeseg
authormarci
Thu, 29 Apr 2004 10:41:56 +0000
changeset 4683a2cb784750a
parent 467 8cab0547eeae
child 469 5f6ea657b75d
nem irunk olyat hogy "void resetTarget(const Node _t) {t=_t;}" mert az a const az ott jobbara hulyeseg
src/work/jacint/preflow.h
     1.1 --- a/src/work/jacint/preflow.h	Thu Apr 29 10:29:51 2004 +0000
     1.2 +++ b/src/work/jacint/preflow.h	Thu Apr 29 10:41:56 2004 +0000
     1.3 @@ -20,7 +20,7 @@
     1.4  
     1.5  void run()
     1.6  
     1.7 -T flowValue() : returns the value of a maximum flow
     1.8 +Num flowValue() : returns the value of a maximum flow
     1.9  
    1.10  void minMinCut(CutMap& M) : sets M to the characteristic vector of the 
    1.11       minimum min cut. M should be a map of bools initialized to false. ??Is it OK?
    1.12 @@ -45,9 +45,9 @@
    1.13  
    1.14  namespace hugo {
    1.15  
    1.16 -  template <typename Graph, typename T, 
    1.17 -	    typename CapMap=typename Graph::template EdgeMap<T>, 
    1.18 -            typename FlowMap=typename Graph::template EdgeMap<T> >
    1.19 +  template <typename Graph, typename Num, 
    1.20 +	    typename CapMap=typename Graph::template EdgeMap<Num>, 
    1.21 +            typename FlowMap=typename Graph::template EdgeMap<Num> >
    1.22    class Preflow {
    1.23      
    1.24      typedef typename Graph::Node Node;
    1.25 @@ -66,7 +66,7 @@
    1.26      FlowMap* flow;
    1.27      int n;      //the number of nodes of G
    1.28      typename Graph::template NodeMap<int> level;      
    1.29 -    typename Graph::template NodeMap<T> excess; 
    1.30 +    typename Graph::template NodeMap<Num> excess; 
    1.31  
    1.32  
    1.33    public:
    1.34 @@ -124,7 +124,7 @@
    1.35  	  //counting the excess
    1.36  	  NodeIt v;
    1.37  	  for(g->first(v); g->valid(v); g->next(v)) {
    1.38 -	    T exc=0;
    1.39 +	    Num exc=0;
    1.40  	  
    1.41  	    InEdgeIt e;
    1.42  	    for(g->first(e,v); g->valid(e); g->next(e)) exc+=(*flow)[e];
    1.43 @@ -142,7 +142,7 @@
    1.44        case GEN_FLOW:
    1.45  	{
    1.46  	  //Counting the excess of t
    1.47 -	  T exc=0;
    1.48 +	  Num exc=0;
    1.49  	  
    1.50  	  InEdgeIt e;
    1.51  	  for(g->first(e,t); g->valid(e); g->next(e)) exc+=(*flow)[e];
    1.52 @@ -261,7 +261,7 @@
    1.53  
    1.54  
    1.55      //Returns the maximum value of a flow.
    1.56 -    T flowValue() {
    1.57 +    Num flowValue() {
    1.58        return excess[t];
    1.59      }
    1.60  
    1.61 @@ -365,16 +365,14 @@
    1.62        minMinCut(M);
    1.63      }
    1.64  
    1.65 -    
    1.66 -    void resetTarget (const Node _t) {t=_t;}
    1.67 -
    1.68 -    void resetSource (const Node _s) {s=_s;}
    1.69 +    void resetTarget(Node _t) {t=_t;}
    1.70 +    void resetSource(Node _s) {s=_s;}
    1.71     
    1.72 -    void resetCap (const CapMap& _cap) {
    1.73 +    void resetCap(const CapMap& _cap) {
    1.74        capacity=&_cap;
    1.75      }
    1.76      
    1.77 -    void resetFlow (FlowMap& _flow) {
    1.78 +    void resetFlow(FlowMap& _flow) {
    1.79        flow=&_flow;
    1.80      }
    1.81  
    1.82 @@ -384,7 +382,7 @@
    1.83      int push(const Node w, VecStack& active) {
    1.84        
    1.85        int lev=level[w];
    1.86 -      T exc=excess[w];
    1.87 +      Num exc=excess[w];
    1.88        int newlevel=n;       //bound on the next level of w
    1.89  	  
    1.90        OutEdgeIt e;
    1.91 @@ -400,9 +398,9 @@
    1.92  	    active[lev_v].push(v);
    1.93  	  }
    1.94  	  
    1.95 -	  T cap=(*capacity)[e];
    1.96 -	  T flo=(*flow)[e];
    1.97 -	  T remcap=cap-flo;
    1.98 +	  Num cap=(*capacity)[e];
    1.99 +	  Num flo=(*flow)[e];
   1.100 +	  Num remcap=cap-flo;
   1.101  	  
   1.102  	  if ( remcap >= exc ) { //A nonsaturating push.
   1.103  	    
   1.104 @@ -433,7 +431,7 @@
   1.105  	      active[lev_v].push(v);
   1.106  	    }
   1.107  	    
   1.108 -	    T flo=(*flow)[e];
   1.109 +	    Num flo=(*flow)[e];
   1.110  	    
   1.111  	    if ( flo >= exc ) { //A nonsaturating push.
   1.112  	      
   1.113 @@ -494,7 +492,7 @@
   1.114  	  OutEdgeIt e;
   1.115  	  for(g->first(e,s); g->valid(e); g->next(e)) 
   1.116  	    {
   1.117 -	      T c=(*capacity)[e];
   1.118 +	      Num c=(*capacity)[e];
   1.119  	      if ( c == 0 ) continue;
   1.120  	      Node w=g->head(e);
   1.121  	      if ( level[w] < n ) {	  
   1.122 @@ -554,7 +552,7 @@
   1.123  	  OutEdgeIt e;
   1.124  	  for(g->first(e,s); g->valid(e); g->next(e)) 
   1.125  	    {
   1.126 -	      T rem=(*capacity)[e]-(*flow)[e];
   1.127 +	      Num rem=(*capacity)[e]-(*flow)[e];
   1.128  	      if ( rem == 0 ) continue;
   1.129  	      Node w=g->head(e);
   1.130  	      if ( level[w] < n ) {	  
   1.131 @@ -586,7 +584,7 @@
   1.132  		  VecNode& level_list, NNMap& left, 
   1.133  		  NNMap& right, int& b, int& k, const bool what_heur ) {
   1.134  
   1.135 -      T lev=level[w];	
   1.136 +      Num lev=level[w];	
   1.137        
   1.138        Node right_n=right[w];
   1.139        Node left_n=left[w];