diff -r bd3e3bfd9148 -r 50184b822370 src/work/athos/mincostflows.h --- a/src/work/athos/mincostflows.h Thu May 06 14:21:57 2004 +0000 +++ b/src/work/athos/mincostflows.h Thu May 06 14:23:48 2004 +0000 @@ -52,8 +52,10 @@ typedef ResGraphWrapper ResGraphType; typedef typename ResGraphType::Edge ResGraphEdge; + class ModLengthMap { - typedef typename ResGraphType::template NodeMap NodeMap; + //typedef typename ResGraphType::template NodeMap NodeMap; + typedef typename Graph::template NodeMap NodeMap; const ResGraphType& G; // const EdgeIntMap& rev; const LengthMap &ol; @@ -87,6 +89,7 @@ //If the algorithm has finished, the edges of the seeked paths are //exactly those that are reversed EdgeIntMap flow; + typename Graph::template NodeMap potential; //Container to store found paths std::vector< std::vector > paths; @@ -100,7 +103,7 @@ MinCostFlows(Graph& _G, LengthMap& _length, CapacityMap& _cap) : G(_G), - length(_length), capacity(_cap), flow(_G)/*, dijkstra_dist(_G)*/{ } + length(_length), capacity(_cap), flow(_G), potential(_G){ } ///Runs the algorithm. @@ -112,17 +115,27 @@ //Resetting variables from previous runs total_length = 0; + FOR_EACH_LOC(typename Graph::EdgeIt, e, G){ flow.set(e,0); } + + FOR_EACH_LOC(typename Graph::NodeIt, n, G){ + //cout << potential[n]< dijkstra_dist(res_graph); - ModLengthMap mod_length(res_graph, length, dijkstra_dist); + + //typename ResGraphType::template NodeMap potential(res_graph); + + + ModLengthMap mod_length(res_graph, length, potential); Dijkstra dijkstra(res_graph, mod_length); @@ -138,7 +151,7 @@ //We have to copy the potential typename ResGraphType::NodeIt n; for ( res_graph.first(n) ; res_graph.valid(n) ; res_graph.next(n) ) { - dijkstra_dist[n] += dijkstra.distMap()[n]; + potential[n] += dijkstra.distMap()[n]; } } @@ -166,6 +179,7 @@ + ///This function gives back the total length of the found paths. ///Assumes that \c run() has been run and nothing changed since then. Length totalLength(){