Public Member Functions | Private Member Functions

MCF1stPass Class Reference

First pass of the MCF calculation. More...

#include <mcf.h>

Inheritance diagram for MCF1stPass:
MultiCommodityFlow

Public Member Functions

 MCF1stPass (LinkGraphJob &job)
 Run the first pass of the MCF calculation.

Private Member Functions

bool EliminateCycles ()
 Eliminate all cycles in the graph.
bool EliminateCycles (PathVector &path, NodeID origin_id, NodeID next_id)
 Eliminate cycles for origin_id in the graph.
void EliminateCycle (PathVector &path, Path *cycle_begin, uint flow)
 Eliminate a cycle of the given flow in the given set of paths.
uint FindCycleFlow (const PathVector &path, const Path *cycle_begin)
 Find the flow along a cycle including cycle_begin in path.

Detailed Description

First pass of the MCF calculation.

Saturates shortest paths first, creates new paths if needed, eliminates cycles. This calculation is of exponential complexity in the number of nodes but the constant factors are sufficiently small to make it usable for most real-life link graph components. You can deal with performance problems that might occur here in multiple ways:

Definition at line 50 of file mcf.h.


Constructor & Destructor Documentation

MCF1stPass::MCF1stPass ( LinkGraphJob job  ) 

Run the first pass of the MCF calculation.

Parameters:
job Link graph job to calculate.

Definition at line 450 of file mcf.cpp.

References LinkGraphSettings::accuracy, MultiCommodityFlow::CleanupPaths(), EliminateCycles(), Path::GetFreeCapacity(), MultiCommodityFlow::max_saturation, MultiCommodityFlow::PushFlow(), LinkGraphJob::Settings(), and LinkGraphJob::Size().


Member Function Documentation

void MCF1stPass::EliminateCycle ( PathVector &  path,
Path cycle_begin,
uint  flow 
) [private]

Eliminate a cycle of the given flow in the given set of paths.

Parameters:
path Set of paths containing the cycle.
cycle_begin Part of the cycle to start at.
flow Flow along the cycle.

Definition at line 347 of file mcf.cpp.

References Path::GetNode(), MultiCommodityFlow::job, and Path::ReduceFlow().

Referenced by EliminateCycles().

bool MCF1stPass::EliminateCycles ( PathVector &  path,
NodeID  origin_id,
NodeID  next_id 
) [private]

Eliminate cycles for origin_id in the graph.

Start searching at next_id and work recursively. Also "summarize" paths: Add up the flows along parallel paths in one.

Parameters:
path Paths checked in parent calls to this method.
origin_id Origin of the paths to be checked.
next_id Next node to be checked.
Returns:
If any cycles have been found and eliminated.

Definition at line 368 of file mcf.cpp.

References Path::AddFlow(), EliminateCycle(), EliminateCycles(), FindCycleFlow(), Path::GetFlow(), Path::GetNode(), Path::GetOrigin(), MultiCommodityFlow::job, and Path::ReduceFlow().

bool MCF1stPass::EliminateCycles (  )  [private]

Eliminate all cycles in the graph.

Check paths starting at each node for potential cycles.

Returns:
If any cycles have been found and eliminated.

Definition at line 432 of file mcf.cpp.

References MultiCommodityFlow::job, and LinkGraphJob::Size().

Referenced by EliminateCycles(), and MCF1stPass().

uint MCF1stPass::FindCycleFlow ( const PathVector &  path,
const Path cycle_begin 
) [private]

Find the flow along a cycle including cycle_begin in path.

Parameters:
path Set of paths that form the cycle.
cycle_begin Path to start at.
Returns:
Flow along the cycle.

Definition at line 330 of file mcf.cpp.

References Path::GetFlow(), and min().

Referenced by EliminateCycles().


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