src/work/athos/mincostflow.h
changeset 986 e997802b855c
parent 921 818510fa3d99
child 987 87f7c54892df
     1.1 --- a/src/work/athos/mincostflow.h	Sat Nov 13 12:24:01 2004 +0000
     1.2 +++ b/src/work/athos/mincostflow.h	Sat Nov 13 12:53:28 2004 +0000
     1.3 @@ -73,9 +73,9 @@
     1.4  	
     1.5        ValueType operator[](typename ResGraph::Edge e) const {     
     1.6  	if (res_graph.forward(e))
     1.7 -	  return  ol[e]-(pot[res_graph.head(e)]-pot[res_graph.tail(e)]);   
     1.8 +	  return  ol[e]-(pot[res_graph.target(e)]-pot[res_graph.source(e)]);   
     1.9  	else
    1.10 -	  return -ol[e]-(pot[res_graph.head(e)]-pot[res_graph.tail(e)]);   
    1.11 +	  return -ol[e]-(pot[res_graph.target(e)]-pot[res_graph.source(e)]);   
    1.12        }     
    1.13  	
    1.14        ModCostMap(const ResGraph& _res_graph,
    1.15 @@ -258,8 +258,8 @@
    1.16  	  typename std::list<Edge>::iterator i = nonabundant_arcs.begin();
    1.17  	  while ( i != nonabundant_arcs.end() ){
    1.18  	    if (flow[*i]>=buf){
    1.19 -	      Node a = abundant_components.find(res_graph.head(*i));
    1.20 -	      Node b = abundant_components.find(res_graph.tail(*i));
    1.21 +	      Node a = abundant_components.find(res_graph.target(*i));
    1.22 +	      Node b = abundant_components.find(res_graph.source(*i));
    1.23  	      //Merge
    1.24  	      if (a != b){
    1.25  		abundant_components.join(a,b);
    1.26 @@ -284,7 +284,7 @@
    1.27  		  ResGraphEdge e;
    1.28  		  while (n!=non_root){
    1.29  		    e = bfs_pred[n];
    1.30 -		    n = res_graph.tail(e);
    1.31 +		    n = res_graph.source(e);
    1.32  		    res_graph.augment(e,qty_to_augment);
    1.33  		  }
    1.34  	  
    1.35 @@ -454,7 +454,7 @@
    1.36        Cost fl_e;
    1.37        FOR_EACH_LOC(typename Graph::EdgeIt, e, graph){
    1.38  	//C^{\Pi}_{i,j}
    1.39 -	mod_pot = cost[e]-potential[graph.head(e)]+potential[graph.tail(e)];
    1.40 +	mod_pot = cost[e]-potential[graph.target(e)]+potential[graph.source(e)];
    1.41  	fl_e = flow[e];
    1.42  	//	std::cout << fl_e << std::endl;
    1.43  	if (mod_pot > 0 && fl_e != 0)
    1.44 @@ -483,8 +483,8 @@
    1.45  
    1.46  	  return false;
    1.47  	}
    1.48 -	supdem[graph.tail(e)] += flow[e];
    1.49 -	supdem[graph.head(e)] -= flow[e];
    1.50 +	supdem[graph.source(e)] += flow[e];
    1.51 +	supdem[graph.target(e)] -= flow[e];
    1.52        }
    1.53        //write_property_vector(supdem, "supdem");
    1.54        //write_property_vector(supply_demand, "supply_demand");