# HG changeset patch # User kpeter # Date 1203942906 0 # Node ID 691ce54544c5e42e88ea869534bb3d65acda2479 # Parent 979a0b389f84fe4b00406b7caee12edc4eac73ab Bug fixes in min cost flow files. Use enum type instead of static constants in NetworkSimplex to avoid linker errors. diff -r 979a0b389f84 -r 691ce54544c5 lemon/min_cost_flow.h --- a/lemon/min_cost_flow.h Thu Feb 21 13:06:33 2008 +0000 +++ b/lemon/min_cost_flow.h Mon Feb 25 12:35:06 2008 +0000 @@ -96,7 +96,7 @@ /// General constructor of the class (without lower bounds). MinCostFlow( const Graph &graph, const CapacityMap &capacity, - const CostMap &_ost, + const CostMap &cost, const SupplyMap &supply ) : MinCostFlowImpl(graph, capacity, cost, supply) {} @@ -104,7 +104,7 @@ MinCostFlow( const Graph &graph, const LowerMap &lower, const CapacityMap &capacity, - const CostMap &_ost, + const CostMap &cost, Node s, Node t, Supply flow_value ) : MinCostFlowImpl( graph, lower, capacity, cost, diff -r 979a0b389f84 -r 691ce54544c5 lemon/min_cost_max_flow.h --- a/lemon/min_cost_max_flow.h Thu Feb 21 13:06:33 2008 +0000 +++ b/lemon/min_cost_max_flow.h Mon Feb 25 12:35:06 2008 +0000 @@ -140,7 +140,7 @@ /// /// \pre \ref run() must be called before using this function. const FlowMap& flowMap() const { - return _flow_result; + return _flow; } /// \brief Returns a const reference to the node map storing the @@ -151,7 +151,7 @@ /// /// \pre \ref run() must be called before using this function. const PotentialMap& potentialMap() const { - return _potential_result; + return _potential; } /// \brief Returns the total cost of the found flow. @@ -162,7 +162,7 @@ /// \pre \ref run() must be called before using this function. Cost totalCost() const { Cost c = 0; - for (typename Graph::EdgeIt e(graph); e != INVALID; ++e) + for (typename Graph::EdgeIt e(_graph); e != INVALID; ++e) c += _flow[e] * _cost[e]; return c; } diff -r 979a0b389f84 -r 691ce54544c5 lemon/network_simplex.h --- a/lemon/network_simplex.h Thu Feb 21 13:06:33 2008 +0000 +++ b/lemon/network_simplex.h Mon Feb 25 12:35:06 2008 +0000 @@ -134,7 +134,7 @@ ReducedCostMap( const SGraph &gr, const SCostMap &cost_map, const SPotentialMap &pot_map ) : - _gr(gr), _cost_map(cost_map), _pot_map(pm) {} + _gr(gr), _cost_map(cost_map), _pot_map(pot_map) {} ///\e Cost operator[](const Edge &e) const { @@ -419,12 +419,12 @@ private: - // State constant for edges at their lower bounds. - static const int STATE_LOWER = 1; - // State constant for edges in the spanning tree. - static const int STATE_TREE = 0; - // State constant for edges at their upper bounds. - static const int STATE_UPPER = -1; + // State constants for edges + enum EdgeStateEnum { + STATE_UPPER = -1, + STATE_TREE = 0, + STATE_LOWER = 1 + }; // Constant for the combined pivot rule. static const int COMBINED_PIVOT_MAX_DEG = 5;