Graph | The directed graph type the algorithm runs on. | |
LowerMap | The type of the lower bound map. | |
CapacityMap | The type of the capacity (upper bound) map. | |
CostMap | The type of the cost (length) map. | |
SupplyMap | The type of the supply map. |
CostMap::Value
must be signed type.long long int
type is used instead of long int
in the inside computations.#include <lemon/cost_scaling.h>
Classes | |
class | ReducedCostMap |
class | ResidualCostMap |
Public Types | |
typedef Graph::template EdgeMap< Capacity > | FlowMap |
The type of the flow map. | |
typedef Graph::template NodeMap< LCost > | PotentialMap |
The type of the potential map. | |
Public Member Functions | |
CostScaling (const Graph &graph, const LowerMap &lower, const CapacityMap &capacity, const CostMap &cost, const SupplyMap &supply) | |
General constructor (with lower bounds). | |
CostScaling (const Graph &graph, const CapacityMap &capacity, const CostMap &cost, const SupplyMap &supply) | |
General constructor (without lower bounds). | |
CostScaling (const Graph &graph, const LowerMap &lower, const CapacityMap &capacity, const CostMap &cost, Node s, Node t, Supply flow_value) | |
Simple constructor (with lower bounds). | |
CostScaling (const Graph &graph, const CapacityMap &capacity, const CostMap &cost, Node s, Node t, Supply flow_value) | |
Simple constructor (without lower bounds). | |
~CostScaling () | |
Destructor. | |
CostScaling & | flowMap (FlowMap &map) |
Set the flow map. | |
CostScaling & | potentialMap (PotentialMap &map) |
Set the potential map. | |
Execution control | |
bool | run (bool partial_augment=true) |
Run the algorithm. | |
Query Functions | |
The result of the algorithm can be obtained using these functions. run() must be called before using them. | |
const FlowMap & | flowMap () const |
Return a const reference to the edge map storing the found flow. | |
const PotentialMap & | potentialMap () 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. | |
Private Member Functions | |
bool | init () |
Initialize the algorithm. | |
bool | startPartialAugment () |
bool | startPushRelabel () |
Execute the algorithm performing push and relabel operations. |
CostScaling | ( | const Graph & | graph, | |
const LowerMap & | lower, | |||
const CapacityMap & | capacity, | |||
const CostMap & | cost, | |||
const SupplyMap & | supply | |||
) | [inline] |
General constructor (with lower bounds).
graph | The directed graph the algorithm runs on. | |
lower | The lower bounds of the edges. | |
capacity | The capacities (upper bounds) of the edges. | |
cost | The cost (length) values of the edges. | |
supply | The supply values of the nodes (signed). |
CostScaling | ( | const Graph & | graph, | |
const CapacityMap & | capacity, | |||
const CostMap & | cost, | |||
const SupplyMap & | supply | |||
) | [inline] |
General constructor (without lower bounds).
graph | The directed graph the algorithm runs on. | |
capacity | The capacities (upper bounds) of the edges. | |
cost | The cost (length) values of the edges. | |
supply | The supply values of the nodes (signed). |
CostScaling | ( | const Graph & | graph, | |
const LowerMap & | lower, | |||
const CapacityMap & | capacity, | |||
const CostMap & | cost, | |||
Node | s, | |||
Node | t, | |||
Supply | flow_value | |||
) | [inline] |
Simple constructor (with lower bounds).
graph | The directed graph the algorithm runs on. | |
lower | The lower bounds of the edges. | |
capacity | The capacities (upper bounds) of the edges. | |
cost | The cost (length) values of the edges. | |
s | The source node. | |
t | The target node. | |
flow_value | The required amount of flow from node s to node t (i.e. the supply of s and the demand of t ). |
CostScaling | ( | const Graph & | graph, | |
const CapacityMap & | capacity, | |||
const CostMap & | cost, | |||
Node | s, | |||
Node | t, | |||
Supply | flow_value | |||
) | [inline] |
Simple constructor (without lower bounds).
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. | |
flow_value | The required amount of flow from node s to node t (i.e. the supply of s and the demand of t ). |
CostScaling& flowMap | ( | FlowMap & | map | ) | [inline] |
Set the flow map.
(*this) CostScaling& potentialMap | ( | PotentialMap & | map | ) | [inline] |
Set the potential map.
(*this) bool run | ( | bool | partial_augment = true |
) | [inline] |
Run the algorithm.
partial_augment | By default the algorithm performs partial augment and relabel operations in the cost scaling phases. Set this parameter to false for using local push and relabel operations instead. |
true
if a feasible flow can be found. const FlowMap& flowMap | ( | ) | const [inline] |
Return a const reference to the edge map storing the found flow.
const PotentialMap& potentialMap | ( | ) | const [inline] |
Return a const reference to the node map storing the found potentials (the dual solution).
Capacity flow | ( | const Edge & | edge | ) | const [inline] |
Cost potential | ( | const Node & | node | ) | const [inline] |
Return the potential of the given node.
Cost totalCost | ( | ) | const [inline] |
Return the total cost of the found flow. The complexity of the function is .
bool startPartialAugment | ( | ) | [inline, private] |
Execute the algorithm performing partial augmentation and relabel operations.