Protected Member Functions | Protected Attributes

MultiCommodityFlow Class Reference

Multi-commodity flow calculating base class. More...

#include <mcf.h>

Inheritance diagram for MultiCommodityFlow:
MCF1stPass MCF2ndPass

Protected Member Functions

 MultiCommodityFlow (LinkGraphComponent *graph)
template<class ANNOTATION >
void Dijkstra (NodeID from, PathVector &paths, bool create_new_paths)
 A slightly modified Dijkstra algorithm.
uint PushFlow (Edge &edge, Path *path, uint accuracy, bool positive_cap)
 Push flow along a path and update the unsatisfied_demand of the associated edge.
void CleanupPaths (NodeID source, PathVector &paths)
 Clean up paths that lead nowhere and the root path.

Protected Attributes

LinkGraphComponentgraph
 the component we're working with

Detailed Description

Multi-commodity flow calculating base class.

Definition at line 69 of file mcf.h.


Member Function Documentation

void MultiCommodityFlow::CleanupPaths ( NodeID  source_id,
PathVector &  paths 
) [protected]

Clean up paths that lead nowhere and the root path.

Parameters:
source_id ID of the root node
paths the paths to be cleaned up

Definition at line 140 of file mcf.cpp.

References Path::GetFlow(), Path::GetNode(), Path::GetNumChildren(), Path::GetParent(), and Path::UnFork().

Referenced by MCF1stPass::MCF1stPass(), and MCF2ndPass::MCF2ndPass().

template<class Tannotation >
void MultiCommodityFlow::Dijkstra ( NodeID  source_node,
PathVector &  paths,
bool  create_new_paths 
) [protected]

A slightly modified Dijkstra algorithm.

Grades the paths not necessarily by distance, but by the value Tannotation computes. It can also be configured to only use paths already created before and not create new ones. If this is not done it uses the short_path_saturation setting to artificially decrease capacities. If a path has already been created is determined by checking the flows associated with its nodes.

Template Parameters:
Tannotation the annotation to be used
Parameters:
source_node the node where the algorithm starts.
paths a container for the paths to be calculated
create_new_paths if false, only use paths already seen before, otherwise artificially limit the capacity

Definition at line 90 of file mcf.cpp.

References Edge::capacity, Edge::distance, Edge::flow, Node::flows, LinkGraphComponent::GetEdge(), LinkGraphComponent::GetFirstEdge(), LinkGraphComponent::GetNode(), LinkGraphComponent::GetSettings(), LinkGraphComponent::GetSize(), graph, Edge::next_edge, LinkGraphSettings::short_path_saturation, and Node::station.

uint MultiCommodityFlow::PushFlow ( Edge edge,
Path path,
uint  accuracy,
bool  positive_cap 
) [protected]

Push flow along a path and update the unsatisfied_demand of the associated edge.

Parameters:
edge the edge whose ends the path connects
path the end of the path the flow should be pushed on
accuracy the accuracy of the calculation
positive_cap if true only push flow up to the paths capacity, otherwise the path can be "overloaded".

Definition at line 171 of file mcf.cpp.

References Path::AddFlow(), Clamp(), Edge::demand, graph, and Edge::unsatisfied_demand.

Referenced by MCF1stPass::MCF1stPass(), and MCF2ndPass::MCF2ndPass().


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