COIN-OR::LEMON - Graph Library

Changeset 2556:74c2c81055e1 in lemon-0.x for lemon/min_cost_max_flow.h


Ignore:
Timestamp:
01/13/08 11:32:14 (16 years ago)
Author:
Peter Kovacs
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3437
Message:

Cleanup in the minimum cost flow files.
The changes only affects the documentation and the look of the source codes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/min_cost_max_flow.h

    r2553 r2556  
    2323///
    2424/// \file
    25 /// \brief An efficient algorithm for finding a minimum cost maximum
    26 /// flow.
     25/// \brief An efficient algorithm for finding a minimum cost maximum flow.
    2726
    2827#include <lemon/preflow.h>
     
    3534  /// @{
    3635
    37   /// \brief An efficient algorithm for finding a minimum cost maximum
    38   /// flow.
     36  /// \brief An efficient algorithm for finding a minimum cost
     37  /// maximum flow.
    3938  ///
    40   /// \ref lemon::MinCostFlow "MinCostMaxFlow" implements an efficient
    41   /// algorithm for finding a maximum flow having minimal total cost
    42   /// from a given source node to a given target node in a directed
    43   /// graph.
     39  /// \ref MinCostMaxFlow implements an efficient algorithm for
     40  /// finding a maximum flow having minimal total cost from a given
     41  /// source node to a given target node in a directed graph.
    4442  ///
    45   /// \note \ref lemon::MinCostMaxFlow "MinCostMaxFlow" uses
    46   /// \ref lemon::Preflow "Preflow" algorithm for finding the maximum
    47   /// flow value and \ref lemon::NetworkSimplex "NetworkSimplex"
    48   /// algorithm for finding a minimum cost flow of that value.
     43  /// \note \ref MinCostMaxFlow uses \ref Preflow algorithm for finding
     44  /// the maximum flow value and \ref NetworkSimplex algorithm for
     45  /// finding a minimum cost flow of that value.
    4946  ///
    5047  /// \param Graph The directed graph type the algorithm runs on.
     
    5350  ///
    5451  /// \warning
    55   /// - Edge capacities and costs should be nonnegative integers.
    56   ///   However \c CostMap::Value should be signed type.
     52  /// - Edge capacities and costs should be non-negative integers.
     53  ///   However \c CostMap::Value should be signed type.
    5754  ///
    5855  /// \author Peter Kovacs
    5956
    6057  template < typename Graph,
    61              typename CapacityMap = typename Graph::template EdgeMap<int>,
    62              typename CostMap = typename Graph::template EdgeMap<int> >
     58             typename CapacityMap = typename Graph::template EdgeMap<int>,
     59             typename CostMap = typename Graph::template EdgeMap<int> >
    6360  class MinCostMaxFlow
    6461  {
     
    6764
    6865    typedef typename CapacityMap::Value Capacity;
     66    typedef typename CostMap::Value Cost;
    6967    typedef typename Graph::template NodeMap<Capacity> SupplyMap;
    7068    typedef NetworkSimplex< Graph, CapacityMap, CapacityMap,
    71                             CostMap, SupplyMap >
     69                            CostMap, SupplyMap >
    7270      MinCostFlowImpl;
    7371
    7472  public:
    7573
    76     /// \brief The type of the flow map.
     74    /// The type of the flow map.
    7775    typedef typename Graph::template EdgeMap<Capacity> FlowMap;
    78     typedef typename CostMap::Value Cost;
    7976
    8077  private:
    8178
    82     /// \brief The directed graph the algorithm runs on.
     79    /// The directed graph the algorithm runs on.
    8380    const Graph &graph;
    84     /// \brief The modified capacity map.
     81    /// The modified capacity map.
    8582    const CapacityMap &capacity;
    86     /// \brief The cost map.
     83    /// The cost map.
    8784    const CostMap &cost;
    88     /// \brief The source node.
     85    /// The edge map of the found flow.
     86    FlowMap flow;
     87    /// The source node.
    8988    Node source;
    90     /// \brief The target node.
     89    /// The target node.
    9190    Node target;
    92     /// \brief The edge map of the found flow.
    93     FlowMap flow;
    9491
    95     typedef Preflow<Graph, CapacityMap> PreflowImpl;
    96     /// \brief \ref lemon::Preflow "Preflow" class for finding the
    97     /// maximum flow value.
    98     PreflowImpl preflow;
     92    typedef Preflow<Graph, CapacityMap> MaxFlowImpl;
     93    /// \brief \ref Preflow class for finding the maximum flow value.
     94    MaxFlowImpl preflow;
    9995
    10096  public:
     
    110106    /// \param _t The target node.
    111107    MinCostMaxFlow( const Graph &_graph,
    112                     const CapacityMap &_capacity,
    113                     const CostMap &_cost,
    114                     Node _s, Node _t ) :
     108                    const CapacityMap &_capacity,
     109                    const CostMap &_cost,
     110                    Node _s, Node _t ) :
    115111      graph(_graph), capacity(_capacity), cost(_cost),
    116112      source(_s), target(_t), flow(_graph),
     
    136132      Cost c = 0;
    137133      for (typename Graph::EdgeIt e(graph); e != INVALID; ++e)
    138         c += flow[e] * cost[e];
     134        c += flow[e] * cost[e];
    139135      return c;
    140136    }
     
    145141      preflow.runMinCut();
    146142      MinCostFlowImpl mcf_impl( graph, capacity, cost,
    147                                 source, target, preflow.flowValue() );
     143                                source, target, preflow.flowValue() );
    148144      mcf_impl.run();
    149145      flow = mcf_impl.flowMap();
Note: See TracChangeset for help on using the changeset viewer.