Multi-commodity flow calculating base class. More...
#include <mcf.h>
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 | |
LinkGraphComponent * | graph |
Component we're working with. |
Multi-commodity flow calculating base class.
Definition at line 62 of file mcf.h.
void MultiCommodityFlow::CleanupPaths | ( | NodeID | source_id, | |
PathVector & | paths | |||
) | [protected] |
Clean up paths that lead nowhere and the root path.
source_id | ID of the root node. | |
paths | Paths to be cleaned up. |
Definition at line 131 of file mcf.cpp.
References Path::Detach(), Path::GetFlow(), Path::GetNode(), Path::GetNumChildren(), and Path::GetParent().
Referenced by MCF1stPass::MCF1stPass(), and MCF2ndPass::MCF2ndPass().
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.
Tannotation | Annotation to be used. |
source_node | Node where the algorithm starts. | |
paths | 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 82 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.
edge | Edge whose ends the path connects. | |
path | End of the path the flow should be pushed on. | |
accuracy | 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 162 of file mcf.cpp.
References Path::AddFlow(), Clamp(), Edge::demand, graph, and Edge::unsatisfied_demand.
Referenced by MCF1stPass::MCF1stPass(), and MCF2ndPass::MCF2ndPass().