COIN-OR::LEMON - Graph Library

Changeset 547:50184b822370 in lemon-0.x for src/work/athos/mincostflows.h


Ignore:
Timestamp:
05/06/04 16:23:48 (16 years ago)
Author:
athos
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@720
Message:

Modified a little bit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/work/athos/mincostflows.h

    r530 r547  
    5353    typedef ResGraphWrapper<const Graph,int,CapacityMap,EdgeIntMap> ResGraphType;
    5454    typedef typename ResGraphType::Edge ResGraphEdge;
     55
    5556    class ModLengthMap {   
    56       typedef typename ResGraphType::template NodeMap<Length> NodeMap;
     57      //typedef typename ResGraphType::template NodeMap<Length> NodeMap;
     58      typedef typename Graph::template NodeMap<Length> NodeMap;
    5759      const ResGraphType& G;
    5860      //      const EdgeIntMap& rev;
     
    8890    //exactly those that are reversed
    8991    EdgeIntMap flow;
     92    typename Graph::template NodeMap<Length> potential;
    9093   
    9194    //Container to store found paths
     
    101104
    102105    MinCostFlows(Graph& _G, LengthMap& _length, CapacityMap& _cap) : G(_G),
    103       length(_length), capacity(_cap), flow(_G)/*, dijkstra_dist(_G)*/{ }
     106      length(_length), capacity(_cap), flow(_G), potential(_G){ }
    104107
    105108   
     
    113116      //Resetting variables from previous runs
    114117      total_length = 0;
     118     
    115119      FOR_EACH_LOC(typename Graph::EdgeIt, e, G){
    116120        flow.set(e,0);
    117121      }
     122     
     123      FOR_EACH_LOC(typename Graph::NodeIt, n, G){
     124        //cout << potential[n]<<endl;
     125        potential.set(n,0);
     126      }
     127     
    118128
    119129     
     
    122132
    123133      //Initialize the copy of the Dijkstra potential to zero
    124       typename ResGraphType::template NodeMap<Length> dijkstra_dist(res_graph);
    125       ModLengthMap mod_length(res_graph, length, dijkstra_dist);
     134     
     135      //typename ResGraphType::template NodeMap<Length> potential(res_graph);
     136
     137
     138      ModLengthMap mod_length(res_graph, length, potential);
    126139
    127140      Dijkstra<ResGraphType, ModLengthMap> dijkstra(res_graph, mod_length);
     
    139152          typename ResGraphType::NodeIt n;
    140153          for ( res_graph.first(n) ; res_graph.valid(n) ; res_graph.next(n) ) {
    141               dijkstra_dist[n] += dijkstra.distMap()[n];
     154              potential[n] += dijkstra.distMap()[n];
    142155          }
    143156        }
     
    167180
    168181
     182
    169183    ///This function gives back the total length of the found paths.
    170184    ///Assumes that \c run() has been run and nothing changed since then.
Note: See TracChangeset for help on using the changeset viewer.