lemon/cycle_canceling.h
changeset 2509 a8081c9cd96a
parent 2457 8c791ee69a45
child 2526 b7727edd44f2
equal deleted inserted replaced
1:3de895e36f2d 2:dc65f131b6cd
    23 ///
    23 ///
    24 /// \file
    24 /// \file
    25 /// \brief A cycle-canceling algorithm for finding a minimum cost flow.
    25 /// \brief A cycle-canceling algorithm for finding a minimum cost flow.
    26 
    26 
    27 #include <vector>
    27 #include <vector>
       
    28 #include <lemon/graph_adaptor.h>
    28 #include <lemon/circulation.h>
    29 #include <lemon/circulation.h>
    29 #include <lemon/graph_adaptor.h>
       
    30 
    30 
    31 /// \brief The used cycle-canceling method.
    31 /// \brief The used cycle-canceling method.
    32 #define LIMITED_CYCLE_CANCELING
    32 #define LIMITED_CYCLE_CANCELING
    33 //#define MIN_MEAN_CYCLE_CANCELING
    33 //#define MIN_MEAN_CYCLE_CANCELING
    34 
    34 
    77   /// \param SupplyMap The type of the supply map.
    77   /// \param SupplyMap The type of the supply map.
    78   ///
    78   ///
    79   /// \warning
    79   /// \warning
    80   /// - Edge capacities and costs should be nonnegative integers.
    80   /// - Edge capacities and costs should be nonnegative integers.
    81   ///	However \c CostMap::Value should be signed type.
    81   ///	However \c CostMap::Value should be signed type.
    82   /// - Supply values should be integers.
    82   /// - Supply values should be signed integers.
    83   /// - \c LowerMap::Value must be convertible to
    83   /// - \c LowerMap::Value must be convertible to
    84   ///	\c CapacityMap::Value and \c CapacityMap::Value must be
    84   ///	\c CapacityMap::Value and \c CapacityMap::Value must be
    85   ///	convertible to \c SupplyMap::Value.
    85   ///	convertible to \c SupplyMap::Value.
    86   ///
    86   ///
    87   /// \author Peter Kovacs
    87   /// \author Peter Kovacs
   129 
   129 
   130       const CostMap &cost_map;
   130       const CostMap &cost_map;
   131 
   131 
   132     public:
   132     public:
   133 
   133 
   134       typedef typename MapBase<ResEdge, Cost>::Value Value;
       
   135       typedef typename MapBase<ResEdge, Cost>::Key Key;
       
   136 
       
   137       ResCostMap(const CostMap &_cost) : cost_map(_cost) {}
   134       ResCostMap(const CostMap &_cost) : cost_map(_cost) {}
   138 
   135 
   139       Value operator[](const Key &e) const {
   136       Cost operator[](const ResEdge &e) const {
   140 	return ResGraph::forward(e) ? cost_map[e] : -cost_map[e];
   137 	return ResGraph::forward(e) ? cost_map[e] : -cost_map[e];
   141       }
   138       }
   142 
   139 
   143     }; //class ResCostMap
   140     }; //class ResCostMap
   144 
   141