MinCostMaxFlow Class Template Reference
[Minimum Cost Flow algorithms]

#include <lemon/min_cost_max_flow.h>

List of all members.


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

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)
 Sets the flow map.
MinCostMaxFlowpotentialMap (PotentialMap &map)
 Sets the potential map.
Execution control
The only way to execute the algorithm is to call the run() function.

void run ()
 Runs the algorithm.
Query Functions
The result of the algorithm can be obtained using these functions.
run() must be called before using them.

const FlowMapflowMap () const
 Returns a const reference to the edge map storing the found flow.
const PotentialMappotentialMap () const
 Returns a const reference to the node map storing the found potentials (the dual solution).
Capacity flow (const Edge &edge) const
 Returns the flow on the given edge.
Cost potential (const Node &node) const
 Returns the potential of the given node.
Cost totalCost () const
 Returns 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]

Sets the flow map.

Returns:
(*this)

MinCostMaxFlow& potentialMap ( PotentialMap map  )  [inline]

Sets the potential map.

Returns:
(*this)

void run (  )  [inline]

Runs the algorithm.

const FlowMap& flowMap (  )  const [inline]

Returns 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]

Returns 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]

Returns the flow on the given edge.

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

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

Returns the potential of the given node.

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

Cost totalCost (  )  const [inline]

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

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


The documentation for this class was generated from the following file:

Generated on Sat Apr 19 14:21:03 2008 for LEMON by  doxygen 1.5.5