Linkgraph: Add support for aborting MCF passes early.
This commit is contained in:
@@ -74,10 +74,11 @@ protected:
|
||||
void EraseFlows(NodeID from);
|
||||
void JoinThread();
|
||||
void SetJobGroup(std::shared_ptr<LinkGraphJobGroup> group);
|
||||
bool IsJobAborted() const;
|
||||
|
||||
public:
|
||||
|
||||
bool IsJobAborted() const;
|
||||
|
||||
/**
|
||||
* A job edge. Wraps a link graph edge and an edge annotation. The
|
||||
* annotation can be modified, the edge is constant.
|
||||
|
@@ -638,7 +638,7 @@ MCF1stPass::MCF1stPass(LinkGraphJob &job) : MultiCommodityFlow(job)
|
||||
}
|
||||
this->CleanupPaths(source, paths);
|
||||
}
|
||||
} while (more_loops || this->EliminateCycles());
|
||||
} while ((more_loops || this->EliminateCycles()) && !job.IsJobAborted());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -653,7 +653,7 @@ MCF2ndPass::MCF2ndPass(LinkGraphJob &job) : MultiCommodityFlow(job)
|
||||
uint size = job.Size();
|
||||
uint accuracy = job.Settings().accuracy;
|
||||
bool demand_left = true;
|
||||
while (demand_left) {
|
||||
while (demand_left && !job.IsJobAborted()) {
|
||||
demand_left = false;
|
||||
for (NodeID source = 0; source < size; ++source) {
|
||||
this->Dijkstra<CapacityAnnotation, FlowEdgeIterator>(source, paths);
|
||||
|
Reference in New Issue
Block a user