That's what I wanted.
5 #include <list_graph.h>
6 #include <hugo/smart_graph.h>
7 #include <hugo/dimacs.h>
8 #include <hugo/time_measure.h>
9 //#include <graph_wrapper.h>
11 //#include <preflow_res.h>
12 #include <for_each_macros.h>
16 // Use a DIMACS max flow file as stdin.
17 // read_dimacs_demo < dimacs_max_flow_file
27 // template <typename B>
35 int main(int, char **) {
37 typedef ListGraph MutableGraph;
39 typedef SmartGraph Graph;
40 // typedef ListGraph Graph;
41 typedef Graph::Node Node;
42 typedef Graph::EdgeIt EdgeIt;
48 // typedef Mize Tize[0];
50 // std::cout << &zize << " " << sizeof(mize) << sizeof(Tize) << std::endl;
51 // std::cout << sizeof(bize) << std::endl;
55 // std::cout << sizeof(k) << std::endl;
63 // std::cout << sizeof(Bumm) << std::endl;
68 Graph::EdgeMap<int> cap(g);
69 //readDimacsMaxFlow(std::cin, g, s, t, cap);
70 readDimacs(std::cin, g, cap, s, t);
72 Graph::EdgeMap<int> flow(g); //0 flow
73 MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> >
74 max_flow_test(g, s, t, cap, flow);
77 std::cout << "preflow ..." << std::endl;
80 std::cout << "elapsed time: " << ts << std::endl;
81 std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
85 std::cout << "preflow ..." << std::endl;
86 FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0);
88 max_flow_test.preflow(MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> >::GEN_FLOW);
89 std::cout << "elapsed time: " << ts << std::endl;
90 std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
94 // std::cout << "wrapped preflow ..." << std::endl;
95 // FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0);
97 // pre_flow_res.run();
98 // std::cout << "elapsed time: " << ts << std::endl;
99 // std::cout << "flow value: "<< pre_flow_test.flowValue() << std::endl;
103 std::cout << "physical blocking flow augmentation ..." << std::endl;
104 FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0);
107 while (max_flow_test.augmentOnBlockingFlow<MutableGraph>()) { ++i; }
108 std::cout << "elapsed time: " << ts << std::endl;
109 std::cout << "number of augmentation phases: " << i << std::endl;
110 std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
114 // std::cout << "faster physical blocking flow augmentation ..." << std::endl;
115 // FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0);
118 // while (max_flow_test.augmentOnBlockingFlow1<MutableGraph>()) { ++i; }
119 // std::cout << "elapsed time: " << ts << std::endl;
120 // std::cout << "number of augmentation phases: " << i << std::endl;
121 // std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
125 std::cout << "on-the-fly blocking flow augmentation ..." << std::endl;
126 FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0);
129 while (max_flow_test.augmentOnBlockingFlow2()) { ++i; }
130 std::cout << "elapsed time: " << ts << std::endl;
131 std::cout << "number of augmentation phases: " << i << std::endl;
132 std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
136 std::cout << "on-the-fly shortest path augmentation ..." << std::endl;
137 FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0);
140 while (max_flow_test.augmentOnShortestPath()) { ++i; }
141 std::cout << "elapsed time: " << ts << std::endl;
142 std::cout << "number of augmentation phases: " << i << std::endl;
143 std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;