[Lemon-commits] kpeter: r3462 - lemon/trunk/lemon

Lemon SVN svn at lemon.cs.elte.hu
Mon Feb 25 13:35:07 CET 2008


Author: kpeter
Date: Mon Feb 25 13:35:06 2008
New Revision: 3462

Modified:
   lemon/trunk/lemon/min_cost_flow.h
   lemon/trunk/lemon/min_cost_max_flow.h
   lemon/trunk/lemon/network_simplex.h

Log:
Bug fixes in min cost flow files.
Use enum type instead of static constants in NetworkSimplex to avoid
linker errors.


Modified: lemon/trunk/lemon/min_cost_flow.h
==============================================================================
--- lemon/trunk/lemon/min_cost_flow.h	(original)
+++ lemon/trunk/lemon/min_cost_flow.h	Mon Feb 25 13:35:06 2008
@@ -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,

Modified: lemon/trunk/lemon/min_cost_max_flow.h
==============================================================================
--- lemon/trunk/lemon/min_cost_max_flow.h	(original)
+++ lemon/trunk/lemon/min_cost_max_flow.h	Mon Feb 25 13:35:06 2008
@@ -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;
     }

Modified: lemon/trunk/lemon/network_simplex.h
==============================================================================
--- lemon/trunk/lemon/network_simplex.h	(original)
+++ lemon/trunk/lemon/network_simplex.h	Mon Feb 25 13:35:06 2008
@@ -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;



More information about the Lemon-commits mailing list