# HG changeset patch # User marci # Date 1093951619 0 # Node ID e46a1f0623a016839d2f4a2d0ed0108dd9cba06c # Parent 4297098d9677bf99b4329ba014905ac0f18b46be ResGraphWrapper is done, so does dimacs.h. diff -r 4297098d9677 -r e46a1f0623a0 src/hugo/graph_wrapper.h --- a/src/hugo/graph_wrapper.h Mon Aug 30 12:01:47 2004 +0000 +++ b/src/hugo/graph_wrapper.h Tue Aug 31 11:26:59 2004 +0000 @@ -347,6 +347,8 @@ }; + + /// A graph wrapper for hiding nodes and edges from a graph. /// This wrapper shows a graph with filtered node-set and @@ -380,69 +382,109 @@ edge_filter_map(&_edge_filter_map) { } typedef typename GraphWrapper::Node Node; - class NodeIt { - friend class GraphWrapper; +// class NodeIt { +// friend class GraphWrapper; +// friend class SubGraphWrapper; +// typename Graph::NodeIt n; +// public: +// NodeIt() { } +// NodeIt(const typename Graph::NodeIt& _n) : n(_n) { } +// NodeIt(const Invalid& i) : n(i) { } +// NodeIt(const SubGraphWrapper& _G) : +// n(*(_G.graph)) { +// while (_G.graph->valid(n) && !(*(_G.node_filter_map))[n]) +// _G.graph->next(n); +// } +// operator Node() const { return Node(typename Graph::Node(n)); } +// }; + class NodeIt : public Node { + const SubGraphWrapper* gw; friend class SubGraphWrapper; - typename Graph::NodeIt n; - public: + public: NodeIt() { } - NodeIt(const typename Graph::NodeIt& _n) : n(_n) { } - NodeIt(const Invalid& i) : n(i) { } - NodeIt(const SubGraphWrapper& _G) : - n(*(_G.graph)) { - while (_G.graph->valid(n) && !(*(_G.node_filter_map))[n]) - _G.graph->next(n); + // NodeIt(const NodeIt& n) : Node(n), gw(n.gw) { } + NodeIt(Invalid i) : Node(i) { } + NodeIt(const SubGraphWrapper& _gw) : + Node(typename Graph::NodeIt(*(_gw.graph))), gw(&_gw) { } + NodeIt(const SubGraphWrapper& _gw, + const Node& n) : + Node(n), gw(&_gw) { } + NodeIt& operator++() { + *(static_cast(this))= + ++(typename Graph::NodeIt(*(gw->graph), *this)); + while (*static_cast(this)!=INVALID && + !(*(gw->node_filter_map))[*this]) + *(static_cast(this))= + ++(typename Graph::NodeIt(*(gw->graph), *this)); + return *this; } - operator Node() const { return Node(typename Graph::Node(n)); } }; typedef typename GraphWrapper::Edge Edge; - class OutEdgeIt { - friend class GraphWrapper; + class OutEdgeIt : public Edge { + const SubGraphWrapper* gw; friend class SubGraphWrapper; - typename Graph::OutEdgeIt e; public: OutEdgeIt() { } - OutEdgeIt(const typename Graph::OutEdgeIt& _e) : e(_e) { } - OutEdgeIt(const Invalid& i) : e(i) { } - OutEdgeIt(const SubGraphWrapper& _G, - const Node& _n) : - e(*(_G.graph), typename Graph::Node(_n)) { - while (_G.graph->valid(e) && !(*(_G.edge_filter_map))[e]) - _G.graph->next(e); + // OutEdgeIt(const OutEdgeIt& e) : Edge(e), gw(e.gw) { } + OutEdgeIt(Invalid i) : Edge(i) { } + OutEdgeIt(const SubGraphWrapper& _gw, const Node& n) : + Edge(typename Graph::OutEdgeIt(*(_gw.graph)), n), gw(&_gw) { } + OutEdgeIt(const SubGraphWrapper& _gw, + const Edge& e) : + Edge(e), gw(&_gw) { } + OutEdgeIt& operator++() { + *(static_cast(this))= + ++(typename Graph::OutEdgeIt(*(gw->graph), *this)); + while (*static_cast(this)!=INVALID && + !(*(gw->edge_filter_map))[*this]) + *(static_cast(this))= + ++(typename Graph::OutEdgeIt(*(gw->graph), *this)); + return *this; } - operator Edge() const { return Edge(typename Graph::Edge(e)); } }; - class InEdgeIt { - friend class GraphWrapper; + class InEdgeIt : public Edge { + const SubGraphWrapper* gw; friend class SubGraphWrapper; - typename Graph::InEdgeIt e; public: InEdgeIt() { } - InEdgeIt(const typename Graph::InEdgeIt& _e) : e(_e) { } - InEdgeIt(const Invalid& i) : e(i) { } - InEdgeIt(const SubGraphWrapper& _G, - const Node& _n) : - e(*(_G.graph), typename Graph::Node(_n)) { - while (_G.graph->valid(e) && !(*(_G.edge_filter_map))[e]) - _G.graph->next(e); + // InEdgeIt(const InEdgeIt& e) : Edge(e), gw(e.gw) { } + InEdgeIt(Invalid i) : Edge(i) { } + InEdgeIt(const SubGraphWrapper& _gw, const Node& n) : + Edge(typename Graph::InEdgeIt(*(_gw.graph)), n), gw(&_gw) { } + InEdgeIt(const SubGraphWrapper& _gw, + const Edge& e) : + Edge(e), gw(&_gw) { } + InEdgeIt& operator++() { + *(static_cast(this))= + ++(typename Graph::InEdgeIt(*(gw->graph), *this)); + while (*static_cast(this)!=INVALID && + !(*(gw->edge_filter_map))[*this]) + *(static_cast(this))= + ++(typename Graph::InEdgeIt(*(gw->graph), *this)); + return *this; } - operator Edge() const { return Edge(typename Graph::Edge(e)); } }; - //typedef typename Graph::SymEdgeIt SymEdgeIt; - class EdgeIt { - friend class GraphWrapper; + class EdgeIt : public Edge { + const SubGraphWrapper* gw; friend class SubGraphWrapper; - typename Graph::EdgeIt e; public: EdgeIt() { } - EdgeIt(const typename Graph::EdgeIt& _e) : e(_e) { } - EdgeIt(const Invalid& i) : e(i) { } - EdgeIt(const SubGraphWrapper& _G) : - e(*(_G.graph)) { - while (_G.graph->valid(e) && !(*(_G.edge_filter_map))[e]) - _G.graph->next(e); + // EdgeIt(const EdgeIt& e) : Edge(e), gw(e.gw) { } + EdgeIt(Invalid i) : Edge(i) { } + EdgeIt(const SubGraphWrapper& _gw) : + Edge(typename Graph::EdgeIt(*(_gw.graph))), gw(&_gw) { } + EdgeIt(const SubGraphWrapper& _gw, + const Edge& e) : + Edge(e), gw(&_gw) { } + EdgeIt& operator++() { + *(static_cast(this))= + ++(typename Graph::EdgeIt(*(gw->graph), *this)); + while (*static_cast(this)!=INVALID && + !(*(gw->edge_filter_map))[*this]) + *(static_cast(this))= + ++(typename Graph::EdgeIt(*(gw->graph), *this)); + return *this; } - operator Edge() const { return Edge(typename Graph::Edge(e)); } }; NodeIt& first(NodeIt& i) const { @@ -458,39 +500,39 @@ i=EdgeIt(*this); return i; } - NodeIt& next(NodeIt& i) const { - this->graph->next(i.n); - while (this->graph->valid(i) && !(*node_filter_map)[i.n]) { - this->graph->next(i.n); } - return i; - } - OutEdgeIt& next(OutEdgeIt& i) const { - this->graph->next(i.e); - while (this->graph->valid(i) && !(*edge_filter_map)[i.e]) { - this->graph->next(i.e); } - return i; - } - InEdgeIt& next(InEdgeIt& i) const { - this->graph->next(i.e); - while (this->graph->valid(i) && !(*edge_filter_map)[i.e]) { - this->graph->next(i.e); } - return i; - } - EdgeIt& next(EdgeIt& i) const { - this->graph->next(i.e); - while (this->graph->valid(i) && !(*edge_filter_map)[i.e]) { - this->graph->next(i.e); } - return i; - } +// NodeIt& next(NodeIt& i) const { +// this->graph->next(i.n); +// while (this->graph->valid(i) && !(*node_filter_map)[i.n]) { +// this->graph->next(i.n); } +// return i; +// } +// OutEdgeIt& next(OutEdgeIt& i) const { +// this->graph->next(i.e); +// while (this->graph->valid(i) && !(*edge_filter_map)[i.e]) { +// this->graph->next(i.e); } +// return i; +// } +// InEdgeIt& next(InEdgeIt& i) const { +// this->graph->next(i.e); +// while (this->graph->valid(i) && !(*edge_filter_map)[i.e]) { +// this->graph->next(i.e); } +// return i; +// } +// EdgeIt& next(EdgeIt& i) const { +// this->graph->next(i.e); +// while (this->graph->valid(i) && !(*edge_filter_map)[i.e]) { +// this->graph->next(i.e); } +// return i; +// } - Node aNode(const OutEdgeIt& e) const { - return Node(this->graph->aNode(e.e)); } - Node aNode(const InEdgeIt& e) const { - return Node(this->graph->aNode(e.e)); } - Node bNode(const OutEdgeIt& e) const { - return Node(this->graph->bNode(e.e)); } - Node bNode(const InEdgeIt& e) const { - return Node(this->graph->bNode(e.e)); } +// Node aNode(const OutEdgeIt& e) const { +// return Node(this->graph->aNode(e.e)); } +// Node aNode(const InEdgeIt& e) const { +// return Node(this->graph->aNode(e.e)); } +// Node bNode(const OutEdgeIt& e) const { +// return Node(this->graph->bNode(e.e)); } +// Node bNode(const InEdgeIt& e) const { +// return Node(this->graph->bNode(e.e)); } /// This function hides \c n in the graph, i.e. the iteration /// jumps over it. This is done by simply setting the value of \c n @@ -753,13 +795,14 @@ !(*(gw->forward_filter))[*this]) *(static_cast(this))= ++(typename Graph::OutEdgeIt(*(gw->graph), *this)); - if (*static_cast(this)==INVALID) + if (*static_cast(this)==INVALID) { *static_cast(this)= Edge(typename Graph::InEdgeIt(*(_gw.graph), n), true); - while (*static_cast(this)!=INVALID && - !(*(gw->backward_filter))[*this]) - *(static_cast(this))= - ++(typename Graph::InEdgeIt(*(gw->graph), *this)); + while (*static_cast(this)!=INVALID && + !(*(gw->backward_filter))[*this]) + *(static_cast(this))= + ++(typename Graph::InEdgeIt(*(gw->graph), *this)); + } } OutEdgeIt(const SubBidirGraphWrapper& _gw, const Edge& e) : @@ -773,13 +816,14 @@ !(*(gw->forward_filter))[*this]) *(static_cast(this))= ++(typename Graph::OutEdgeIt(*(gw->graph), *this)); - if (*static_cast(this)==INVALID) + if (*static_cast(this)==INVALID) { *static_cast(this)= Edge(typename Graph::InEdgeIt(*(gw->graph), n), true); - while (*static_cast(this)!=INVALID && - !(*(gw->backward_filter))[*this]) - *(static_cast(this))= - ++(typename Graph::InEdgeIt(*(gw->graph), *this)); + while (*static_cast(this)!=INVALID && + !(*(gw->backward_filter))[*this]) + *(static_cast(this))= + ++(typename Graph::InEdgeIt(*(gw->graph), *this)); + } } else { *(static_cast(this))= ++(typename Graph::InEdgeIt(*(gw->graph), *this)); @@ -809,33 +853,35 @@ !(*(gw->forward_filter))[*this]) *(static_cast(this))= ++(typename Graph::InEdgeIt(*(gw->graph), *this)); - if (*static_cast(this)==INVALID) + if (*static_cast(this)==INVALID) { *static_cast(this)= Edge(typename Graph::OutEdgeIt(*(_gw.graph), n), true); - while (*static_cast(this)!=INVALID && - !(*(gw->backward_filter))[*this]) - *(static_cast(this))= - ++(typename Graph::OutEdgeIt(*(gw->graph), *this)); + while (*static_cast(this)!=INVALID && + !(*(gw->backward_filter))[*this]) + *(static_cast(this))= + ++(typename Graph::OutEdgeIt(*(gw->graph), *this)); + } } InEdgeIt(const SubBidirGraphWrapper& _gw, const Edge& e) : Edge(e), gw(&_gw) { } InEdgeIt& operator++() { if (!this->backward) { - Node n=gw->head(*this); + Node n=gw->tail(*this); *(static_cast(this))= ++(typename Graph::InEdgeIt(*(gw->graph), *this)); while (*static_cast(this)!=INVALID && !(*(gw->forward_filter))[*this]) *(static_cast(this))= ++(typename Graph::InEdgeIt(*(gw->graph), *this)); - if (*static_cast(this)==INVALID) + if (*static_cast(this)==INVALID) { *static_cast(this)= Edge(typename Graph::OutEdgeIt(*(gw->graph), n), true); - while (*static_cast(this)!=INVALID && - !(*(gw->backward_filter))[*this]) - *(static_cast(this))= - ++(typename Graph::OutEdgeIt(*(gw->graph), *this)); + while (*static_cast(this)!=INVALID && + !(*(gw->backward_filter))[*this]) + *(static_cast(this))= + ++(typename Graph::OutEdgeIt(*(gw->graph), *this)); + } } else { *(static_cast(this))= ++(typename Graph::OutEdgeIt(*(gw->graph), *this)); @@ -859,19 +905,20 @@ EdgeIt(Invalid i) : Edge(i) { } //the unique invalid iterator EdgeIt(const SubBidirGraphWrapper& _gw) : - Edge(typename Graph::EdgeIt(*(_gw.graph)), false), gw(&_gw) { + ForwardFilterMap, BackwardFilterMap>& _gw) : + Edge(typename Graph::OutEdgeIt(*(_gw.graph)), false), gw(&_gw) { while (*static_cast(this)!=INVALID && !(*(gw->forward_filter))[*this]) *(static_cast(this))= ++(typename Graph::EdgeIt(*(gw->graph), *this)); - if (*static_cast(this)==INVALID) + if (*static_cast(this)==INVALID) { *static_cast(this)= Edge(typename Graph::EdgeIt(*(_gw.graph)), true); - while (*static_cast(this)!=INVALID && - !(*(gw->backward_filter))[*this]) - *(static_cast(this))= - ++(typename Graph::EdgeIt(*(gw->graph), *this)); + while (*static_cast(this)!=INVALID && + !(*(gw->backward_filter))[*this]) + *(static_cast(this))= + ++(typename Graph::EdgeIt(*(gw->graph), *this)); + } } EdgeIt(const SubBidirGraphWrapper& _gw, const Edge& e) : @@ -884,13 +931,14 @@ !(*(gw->forward_filter))[*this]) *(static_cast(this))= ++(typename Graph::EdgeIt(*(gw->graph), *this)); - if (*static_cast(this)==INVALID) + if (*static_cast(this)==INVALID) { *static_cast(this)= Edge(typename Graph::EdgeIt(*(gw->graph)), true); - while (*static_cast(this)!=INVALID && - !(*(gw->backward_filter))[*this]) - *(static_cast(this))= - ++(typename Graph::EdgeIt(*(gw->graph), *this)); + while (*static_cast(this)!=INVALID && + !(*(gw->backward_filter))[*this]) + *(static_cast(this))= + ++(typename Graph::EdgeIt(*(gw->graph), *this)); + } } else { *(static_cast(this))= ++(typename Graph::EdgeIt(*(gw->graph), *this)); diff -r 4297098d9677 -r e46a1f0623a0 src/work/marci/augmenting_flow.h --- a/src/work/marci/augmenting_flow.h Mon Aug 30 12:01:47 2004 +0000 +++ b/src/work/marci/augmenting_flow.h Tue Aug 31 11:26:59 2004 +0000 @@ -1020,7 +1020,7 @@ break; case AFTER_AUGMENTING: // std::cout << "AFTER_AUGMENTING" << std::endl; - for(g->first(v); g->valid(v); g->next(v)) { + for(g->first(v); v!=INVALID; ++v) { if (level[v]) { M.set(v, true); } else { @@ -1030,7 +1030,7 @@ break; case AFTER_FAST_AUGMENTING: // std::cout << "AFTER_FAST_AUGMENTING" << std::endl; - for(g->first(v); g->valid(v); g->next(v)) { + for(g->first(v); v!=INVALID; ++v) { if (level[v]==number_of_augmentations) { M.set(v, true); } else { @@ -1053,7 +1053,7 @@ queue.pop(); OutEdgeIt e; - for(g->first(e,w) ; g->valid(e); g->next(e)) { + for(g->first(e,w) ; e!=INVALID; ++e) { Node v=g->head(e); if (!M[v] && (*flow)[e] < (*capacity)[e] ) { queue.push(v); @@ -1062,7 +1062,7 @@ } InEdgeIt f; - for(g->first(f,w) ; g->valid(f); g->next(f)) { + for(g->first(f,w) ; f!=INVALID; ++f) { Node v=g->tail(f); if (!M[v] && (*flow)[f] > 0 ) { queue.push(v); @@ -1133,11 +1133,11 @@ //searching for augmenting path while ( !bfs.finished() ) { ResGWOutEdgeIt e=bfs; - if (res_graph.valid(e) && bfs.isBNodeNewlyReached()) { + if (e!=INVALID && bfs.isBNodeNewlyReached()) { Node v=res_graph.tail(e); Node w=res_graph.head(e); pred.set(w, e); - if (res_graph.valid(pred[v])) { + if (pred[v]!=INVALID) { free.set(w, std::min(free[v], res_graph.resCap(e))); } else { free.set(w, res_graph.resCap(e)); @@ -1151,7 +1151,7 @@ if (_augment) { Node n=t; Num augment_value=free[t]; - while (res_graph.valid(pred[n])) { + while (pred[n]!=INVALID) { ResGWEdge e=pred[n]; res_graph.augment(e, augment_value); n=res_graph.tail(e); @@ -1190,11 +1190,11 @@ //searching for augmenting path while ( !bfs.finished() ) { ResGWOutEdgeIt e=bfs; - if (res_graph.valid(e) && bfs.isBNodeNewlyReached()) { + if (e!=INVALID && bfs.isBNodeNewlyReached()) { Node v=res_graph.tail(e); Node w=res_graph.head(e); pred.set(w, e); - if (res_graph.valid(pred[v])) { + if (pred[v]!=INVALID) { free.set(w, std::min(free[v], res_graph.resCap(e))); } else { free.set(w, res_graph.resCap(e)); @@ -1208,7 +1208,7 @@ if (_augment) { Node n=t; Num augment_value=free[t]; - while (res_graph.valid(pred[n])) { + while (pred[n]!=INVALID) { ResGWEdge e=pred[n]; res_graph.augment(e, augment_value); n=res_graph.tail(e); @@ -1244,7 +1244,7 @@ res_graph_to_F(res_graph); { typename ResGW::NodeIt n; - for(res_graph.first(n); res_graph.valid(n); res_graph.next(n)) { + for(res_graph.first(n); n!=INVALID; ++n) { res_graph_to_F.set(n, F.addNode()); } } @@ -1256,7 +1256,7 @@ while ( !bfs.finished() ) { ResGWOutEdgeIt e=bfs; - if (res_graph.valid(e)) { + if (e!=INVALID) { if (bfs.isBNodeNewlyReached()) { dist.set(res_graph.head(e), dist[res_graph.tail(e)]+1); typename MG::Edge f=F.addEdge(res_graph_to_F[res_graph.tail(e)], @@ -1299,7 +1299,7 @@ typename MG::Node v=F.aNode(dfs); typename MG::Node w=F.bNode(dfs); pred.set(w, dfs); - if (F.valid(pred[v])) { + if (pred[v]!=INVALID) { free.set(w, std::min(free[v], residual_capacity[dfs])); } else { free.set(w, residual_capacity[dfs]); @@ -1319,7 +1319,7 @@ if (__augment) { typename MG::Node n=tF; Num augment_value=free[tF]; - while (F.valid(pred[n])) { + while (pred[n]!=INVALID) { typename MG::Edge e=pred[n]; res_graph.augment(original_edge[e], augment_value); n=F.tail(e); @@ -1337,8 +1337,6 @@ } - - template bool AugmentingFlow::augmentOnBlockingFlow2() { @@ -1354,7 +1352,7 @@ DistanceMap dist(res_graph); while ( !bfs.finished() ) { ResGWOutEdgeIt e=bfs; - if (res_graph.valid(e) && bfs.isBNodeNewlyReached()) { + if (e!=INVALID && bfs.isBNodeNewlyReached()) { dist.set(res_graph.head(e), dist[res_graph.tail(e)]+1); } ++bfs; @@ -1371,8 +1369,7 @@ typename FilterResGW::template NodeMap first_out_edges(filter_res_graph); typename FilterResGW::NodeIt v; - for(filter_res_graph.first(v); filter_res_graph.valid(v); - filter_res_graph.next(v)) + for(filter_res_graph.first(v); v!=INVALID; ++v) { typename FilterResGW::OutEdgeIt e; filter_res_graph.first(e, v); @@ -1418,7 +1415,7 @@ typename ErasingResGW::Node w=erasing_res_graph.bNode(dfs); pred.set(w, /*typename ErasingResGW::OutEdgeIt*/(dfs)); - if (erasing_res_graph.valid(pred[v])) { + if (pred[v]!=INVALID) { free1.set (w, std::min(free1[v], res_graph.resCap (typename ErasingResGW::OutEdgeIt(dfs)))); diff -r 4297098d9677 -r e46a1f0623a0 src/work/marci/makefile --- a/src/work/marci/makefile Mon Aug 30 12:01:47 2004 +0000 +++ b/src/work/marci/makefile Tue Aug 31 11:26:59 2004 +0000 @@ -4,7 +4,7 @@ INCLUDEDIRS ?= -I../{jacint,marci,alpar,klao,akos,athos} -I../.. -I.. -I$(BOOSTROOT) LEDABINARIES = leda_graph_demo leda_bfs_dfs max_bipartite_matching_demo -BINARIES = graph_wrapper_time max_flow_demo iterator_bfs_demo macro_test lg_vs_sg_vs_sg bfsit_vs_byhand bipartite_graph_wrapper_test bipartite_matching_demo top_sort_test max_flow_1 proba7 +BINARIES = graph_wrapper_time max_flow_demo iterator_bfs_demo macro_test lg_vs_sg_vs_sg bfsit_vs_byhand bipartite_graph_wrapper_test bipartite_matching_demo top_sort_test max_flow_1 proba7 proba8 #BINARIES = preflow_bug #gw_vs_not preflow_demo_boost edmonds_karp_demo_boost preflow_demo_jacint preflow_demo_athos edmonds_karp_demo_alpar preflow_demo_leda diff -r 4297098d9677 -r e46a1f0623a0 src/work/marci/max_flow_demo.cc --- a/src/work/marci/max_flow_demo.cc Mon Aug 30 12:01:47 2004 +0000 +++ b/src/work/marci/max_flow_demo.cc Tue Aug 31 11:26:59 2004 +0000 @@ -16,23 +16,7 @@ using namespace hugo; // Use a DIMACS max flow file as stdin. -// read_dimacs_demo < dimacs_max_flow_file - - -// struct Ize { -// }; - -// struct Mize { -// Ize bumm; -// }; - -// template -// class Huha { -// public: -// int u; -// B brr; -// }; - +// max_flow_demo < dimacs_max_flow_file int main(int, char **) { @@ -44,28 +28,6 @@ typedef Graph::Node Node; typedef Graph::EdgeIt EdgeIt; - -// Mize mize[10]; -// Mize bize[0]; -// Mize zize; -// typedef Mize Tize[0]; - -// std::cout << &zize << " " << sizeof(mize) << sizeof(Tize) << std::endl; -// std::cout << sizeof(bize) << std::endl; - - -// Huha k; -// std::cout << sizeof(k) << std::endl; - - -// struct Bumm { -// //int a; -// bool b; -// }; - -// std::cout << sizeof(Bumm) << std::endl; - - Graph g; Node s, t; @@ -141,35 +103,24 @@ } // { -// std::cout << "faster physical blocking flow augmentation ..." << std::endl; +// std::cout << "on-the-fly blocking flow augmentation ..." << std::endl; // FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0); // ts.reset(); // int i=0; -// while (max_flow_test.augmentOnBlockingFlow1()) { ++i; } +// while (augmenting_flow_test.augmentOnBlockingFlow2()) { ++i; } // std::cout << "elapsed time: " << ts << std::endl; // std::cout << "number of augmentation phases: " << i << std::endl; -// std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl; +// std::cout << "flow value: "<< augmenting_flow_test.flowValue() << std::endl; + +// FOR_EACH_LOC(Graph::EdgeIt, e, g) { +// if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e]) +// std::cout << "Slackness does not hold!" << std::endl; +// if (!cut[g.tail(e)] && cut[g.head(e)] && flow[e]>0) +// std::cout << "Slackness does not hold!" << std::endl; +// } // } { - std::cout << "on-the-fly blocking flow augmentation ..." << std::endl; - FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0); - ts.reset(); - int i=0; - while (augmenting_flow_test.augmentOnBlockingFlow2()) { ++i; } - std::cout << "elapsed time: " << ts << std::endl; - std::cout << "number of augmentation phases: " << i << std::endl; - std::cout << "flow value: "<< augmenting_flow_test.flowValue() << std::endl; - - FOR_EACH_LOC(Graph::EdgeIt, e, g) { - if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e]) - std::cout << "Slackness does not hold!" << std::endl; - if (!cut[g.tail(e)] && cut[g.head(e)] && flow[e]>0) - std::cout << "Slackness does not hold!" << std::endl; - } - } - - { std::cout << "on-the-fly shortest path augmentation ..." << std::endl; FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0); ts.reset();