MinCostMaxFlow< Graph, CapacityMap, CostMap > Class Template Reference
[Minimum Cost Flow algorithms]


Detailed Description

template<typename Graph, typename CapacityMap = typename Graph::template EdgeMap<int>, typename CostMap = typename Graph::template EdgeMap<int>>
class lemon::MinCostMaxFlow< Graph, CapacityMap, CostMap >

MinCostMaxFlow implements an efficient algorithm for finding a maximum flow having minimal total cost from a given source node to a given target node in a directed graph.

MinCostMaxFlow uses Preflow for finding the maximum flow value and NetworkSimplex for finding a minimum cost flow of that value. According to our benchmark tests Preflow is generally the most efficient algorithm for the maximum flow problem and NetworkSimplex is the most efficient for the minimum cost flow problem in LEMON.

Template Parameters:
Graph The directed graph type the algorithm runs on.
CapacityMap The type of the capacity (upper bound) map.
CostMap The type of the cost (length) map.
Warning:
  • Edge capacities and costs should be non-negative integers.
  • CapacityMap::Value must be convertible to CostMap::Value.
  • CostMap::Value must be signed type.
Author:
Peter Kovacs
#include <lemon/min_cost_max_flow.h>

List of all members.

Public Types

typedef Graph::template
EdgeMap< Capacity > 
FlowMap
 The type of the flow map.
typedef Graph::template
NodeMap< Cost > 
PotentialMap
 The type of the potential map.

Public Member Functions

 MinCostMaxFlow (const Graph &graph, const CapacityMap &capacity, const CostMap &cost, Node s, Node t)
 Constructor.
 ~MinCostMaxFlow ()
 Destructor.
MinCostMaxFlowflowMap (FlowMap &map)
 Set the flow map.
MinCostMaxFlowpotentialMap (PotentialMap &map)
 Set the potential map.
Execution control
void run ()
Query Functions
The results of the algorithm can be obtained using these functions.
run() must be called before using them.

const FlowMapflowMap () const
 Return a const reference to the edge map storing the found flow.
const PotentialMappotentialMap () const
 Return a const reference to the node map storing the found potentials (the dual solution).
Capacity flow (const Edge &edge) const
 Return the flow on the given edge.
Cost potential (const Node &node) const
 Return the potential of the given node.
Cost totalCost () const
 Return the total cost of the found flow.


Constructor & Destructor Documentation

MinCostMaxFlow ( const Graph graph,
const CapacityMap &  capacity,
const CostMap &  cost,
Node  s,
Node  t 
) [inline]

Constructor.

Parameters:
graph The directed graph the algorithm runs on.
capacity The capacities (upper bounds) of the edges.
cost The cost (length) values of the edges.
s The source node.
t The target node.


Member Function Documentation

MinCostMaxFlow& flowMap ( FlowMap map  )  [inline]

Set the flow map.

Returns:
(*this)

MinCostMaxFlow& potentialMap ( PotentialMap map  )  [inline]

Set the potential map.

Returns:
(*this)

void run (  )  [inline]

Run the algorithm.

const FlowMap& flowMap (  )  const [inline]

Return a const reference to the edge map storing the found flow.

Precondition:
run() must be called before using this function.

const PotentialMap& potentialMap (  )  const [inline]

Return a const reference to the node map storing the found potentials (the dual solution).

Precondition:
run() must be called before using this function.

Capacity flow ( const Edge &  edge  )  const [inline]

Return the flow on the given edge.

Precondition:
run() must be called before using this function.

Cost potential ( const Node &  node  )  const [inline]

Return the potential of the given node.

Precondition:
run() must be called before using this function.

Cost totalCost (  )  const [inline]

Return the total cost of the found flow. The complexity of the function is $ O(e) $.

Precondition:
run() must be called before using this function.


Generated on Thu Jun 4 04:06:23 2009 for LEMON by  doxygen 1.5.9