# mcf.h

Go to the documentation of this file.

    00001
    00003 #ifndef MCF_H
    00004 #define MCF_H
    00005
    00006 #include "linkgraphjob_base.h"
    00007 #include <vector>
    00008
    00009 typedef std::vector<Path *> PathVector;
    00010
    00014 class MultiCommodityFlow {
    00015 protected:
    00020   MultiCommodityFlow(LinkGraphJob &job) : job(job),
    00021       max_saturation(job.Settings().short_path_saturation)
    00022   {}
    00023
    00024   template<class Tannotation, class Tedge_iterator>
    00025   void Dijkstra(NodeID from, PathVector &paths);
    00026
    00027   uint PushFlow(Edge &edge, Path *path, uint accuracy, uint max_saturation);
    00028
    00029   void CleanupPaths(NodeID source, PathVector &paths);
    00030
    00031   LinkGraphJob &job;
    00032   uint max_saturation;
    00033 };
    00034
    00050 class MCF1stPass : public MultiCommodityFlow {
    00051 private:
    00052   bool EliminateCycles();
    00053   bool EliminateCycles(PathVector &path, NodeID origin_id, NodeID next_id);
    00054   void EliminateCycle(PathVector &path, Path *cycle_begin, uint flow);
    00055   uint FindCycleFlow(const PathVector &path, const Path *cycle_begin);
    00056 public:
    00057   MCF1stPass(LinkGraphJob &job);
    00058 };
    00059
    00067 class MCF2ndPass : public MultiCommodityFlow {
    00068 public:
    00069   MCF2ndPass(LinkGraphJob &job);
    00070 };
    00071
    00076 template<class Tpass>
    00077 class MCFHandler : public ComponentHandler {
    00078 public:
    00079
    00084   virtual void Run(LinkGraphJob &job) const { Tpass pass(job); }
    00085
    00089   virtual ~MCFHandler() {}
    00090 };
    00091
    00092 #endif /* MCF_H */