Bug fixes in min cost flow files.
authorkpeter
Mon, 25 Feb 2008 12:35:06 +0000
changeset 2579691ce54544c5
parent 2578 979a0b389f84
child 2580 fa71d9612c42
Bug fixes in min cost flow files.
Use enum type instead of static constants in NetworkSimplex to avoid
linker errors.
lemon/min_cost_flow.h
lemon/min_cost_max_flow.h
lemon/network_simplex.h
     1.1 --- a/lemon/min_cost_flow.h	Thu Feb 21 13:06:33 2008 +0000
     1.2 +++ b/lemon/min_cost_flow.h	Mon Feb 25 12:35:06 2008 +0000
     1.3 @@ -96,7 +96,7 @@
     1.4      /// General constructor of the class (without lower bounds).
     1.5      MinCostFlow( const Graph &graph,
     1.6                   const CapacityMap &capacity,
     1.7 -                 const CostMap &_ost,
     1.8 +                 const CostMap &cost,
     1.9                   const SupplyMap &supply ) :
    1.10        MinCostFlowImpl(graph, capacity, cost, supply) {}
    1.11  
    1.12 @@ -104,7 +104,7 @@
    1.13      MinCostFlow( const Graph &graph,
    1.14                   const LowerMap &lower,
    1.15                   const CapacityMap &capacity,
    1.16 -                 const CostMap &_ost,
    1.17 +                 const CostMap &cost,
    1.18                   Node s, Node t,
    1.19                   Supply flow_value ) :
    1.20        MinCostFlowImpl( graph, lower, capacity, cost,
     2.1 --- a/lemon/min_cost_max_flow.h	Thu Feb 21 13:06:33 2008 +0000
     2.2 +++ b/lemon/min_cost_max_flow.h	Mon Feb 25 12:35:06 2008 +0000
     2.3 @@ -140,7 +140,7 @@
     2.4      ///
     2.5      /// \pre \ref run() must be called before using this function.
     2.6      const FlowMap& flowMap() const {
     2.7 -      return _flow_result;
     2.8 +      return _flow;
     2.9      }
    2.10  
    2.11      /// \brief Returns a const reference to the node map storing the
    2.12 @@ -151,7 +151,7 @@
    2.13      ///
    2.14      /// \pre \ref run() must be called before using this function.
    2.15      const PotentialMap& potentialMap() const {
    2.16 -      return _potential_result;
    2.17 +      return _potential;
    2.18      }
    2.19  
    2.20      /// \brief Returns the total cost of the found flow.
    2.21 @@ -162,7 +162,7 @@
    2.22      /// \pre \ref run() must be called before using this function.
    2.23      Cost totalCost() const {
    2.24        Cost c = 0;
    2.25 -      for (typename Graph::EdgeIt e(graph); e != INVALID; ++e)
    2.26 +      for (typename Graph::EdgeIt e(_graph); e != INVALID; ++e)
    2.27          c += _flow[e] * _cost[e];
    2.28        return c;
    2.29      }
     3.1 --- a/lemon/network_simplex.h	Thu Feb 21 13:06:33 2008 +0000
     3.2 +++ b/lemon/network_simplex.h	Mon Feb 25 12:35:06 2008 +0000
     3.3 @@ -134,7 +134,7 @@
     3.4        ReducedCostMap( const SGraph &gr,
     3.5                        const SCostMap &cost_map,
     3.6                        const SPotentialMap &pot_map ) :
     3.7 -        _gr(gr), _cost_map(cost_map), _pot_map(pm) {}
     3.8 +        _gr(gr), _cost_map(cost_map), _pot_map(pot_map) {}
     3.9  
    3.10        ///\e
    3.11        Cost operator[](const Edge &e) const {
    3.12 @@ -419,12 +419,12 @@
    3.13  
    3.14    private:
    3.15  
    3.16 -    // State constant for edges at their lower bounds.
    3.17 -    static const int STATE_LOWER =  1;
    3.18 -    // State constant for edges in the spanning tree.
    3.19 -    static const int STATE_TREE  =  0;
    3.20 -    // State constant for edges at their upper bounds.
    3.21 -    static const int STATE_UPPER = -1;
    3.22 +    // State constants for edges
    3.23 +    enum EdgeStateEnum {
    3.24 +      STATE_UPPER = -1,
    3.25 +      STATE_TREE  =  0,
    3.26 +      STATE_LOWER =  1
    3.27 +    };
    3.28  
    3.29      // Constant for the combined pivot rule.
    3.30      static const int COMBINED_PIVOT_MAX_DEG = 5;