14 #include <graph_concept.h> |
14 #include <graph_concept.h> |
15 |
15 |
16 using namespace hugo; |
16 using namespace hugo; |
17 |
17 |
18 // Use a DIMACS max flow file as stdin. |
18 // Use a DIMACS max flow file as stdin. |
19 // read_dimacs_demo < dimacs_max_flow_file |
19 // max_flow_demo < dimacs_max_flow_file |
20 |
|
21 |
|
22 // struct Ize { |
|
23 // }; |
|
24 |
|
25 // struct Mize { |
|
26 // Ize bumm; |
|
27 // }; |
|
28 |
|
29 // template <typename B> |
|
30 // class Huha { |
|
31 // public: |
|
32 // int u; |
|
33 // B brr; |
|
34 // }; |
|
35 |
|
36 |
20 |
37 int main(int, char **) { |
21 int main(int, char **) { |
38 |
22 |
39 typedef SageGraph MutableGraph; |
23 typedef SageGraph MutableGraph; |
40 |
24 |
41 //typedef FullFeatureGraphConcept Graph; |
25 //typedef FullFeatureGraphConcept Graph; |
42 //typedef SmartGraph Graph; |
26 //typedef SmartGraph Graph; |
43 typedef SageGraph Graph; |
27 typedef SageGraph Graph; |
44 typedef Graph::Node Node; |
28 typedef Graph::Node Node; |
45 typedef Graph::EdgeIt EdgeIt; |
29 typedef Graph::EdgeIt EdgeIt; |
46 |
|
47 |
|
48 // Mize mize[10]; |
|
49 // Mize bize[0]; |
|
50 // Mize zize; |
|
51 // typedef Mize Tize[0]; |
|
52 |
|
53 // std::cout << &zize << " " << sizeof(mize) << sizeof(Tize) << std::endl; |
|
54 // std::cout << sizeof(bize) << std::endl; |
|
55 |
|
56 |
|
57 // Huha<Tize> k; |
|
58 // std::cout << sizeof(k) << std::endl; |
|
59 |
|
60 |
|
61 // struct Bumm { |
|
62 // //int a; |
|
63 // bool b; |
|
64 // }; |
|
65 |
|
66 // std::cout << sizeof(Bumm) << std::endl; |
|
67 |
|
68 |
30 |
69 Graph g; |
31 Graph g; |
70 |
32 |
71 Node s, t; |
33 Node s, t; |
72 Graph::EdgeMap<int> cap(g); |
34 Graph::EdgeMap<int> cap(g); |
139 std::cout << "Slackness does not hold!" << std::endl; |
101 std::cout << "Slackness does not hold!" << std::endl; |
140 } |
102 } |
141 } |
103 } |
142 |
104 |
143 // { |
105 // { |
144 // std::cout << "faster physical blocking flow augmentation ..." << std::endl; |
106 // std::cout << "on-the-fly blocking flow augmentation ..." << std::endl; |
145 // FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0); |
107 // FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0); |
146 // ts.reset(); |
108 // ts.reset(); |
147 // int i=0; |
109 // int i=0; |
148 // while (max_flow_test.augmentOnBlockingFlow1<MutableGraph>()) { ++i; } |
110 // while (augmenting_flow_test.augmentOnBlockingFlow2()) { ++i; } |
149 // std::cout << "elapsed time: " << ts << std::endl; |
111 // std::cout << "elapsed time: " << ts << std::endl; |
150 // std::cout << "number of augmentation phases: " << i << std::endl; |
112 // std::cout << "number of augmentation phases: " << i << std::endl; |
151 // std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl; |
113 // std::cout << "flow value: "<< augmenting_flow_test.flowValue() << std::endl; |
|
114 |
|
115 // FOR_EACH_LOC(Graph::EdgeIt, e, g) { |
|
116 // if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e]) |
|
117 // std::cout << "Slackness does not hold!" << std::endl; |
|
118 // if (!cut[g.tail(e)] && cut[g.head(e)] && flow[e]>0) |
|
119 // std::cout << "Slackness does not hold!" << std::endl; |
|
120 // } |
152 // } |
121 // } |
153 |
|
154 { |
|
155 std::cout << "on-the-fly blocking flow augmentation ..." << std::endl; |
|
156 FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0); |
|
157 ts.reset(); |
|
158 int i=0; |
|
159 while (augmenting_flow_test.augmentOnBlockingFlow2()) { ++i; } |
|
160 std::cout << "elapsed time: " << ts << std::endl; |
|
161 std::cout << "number of augmentation phases: " << i << std::endl; |
|
162 std::cout << "flow value: "<< augmenting_flow_test.flowValue() << std::endl; |
|
163 |
|
164 FOR_EACH_LOC(Graph::EdgeIt, e, g) { |
|
165 if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e]) |
|
166 std::cout << "Slackness does not hold!" << std::endl; |
|
167 if (!cut[g.tail(e)] && cut[g.head(e)] && flow[e]>0) |
|
168 std::cout << "Slackness does not hold!" << std::endl; |
|
169 } |
|
170 } |
|
171 |
122 |
172 { |
123 { |
173 std::cout << "on-the-fly shortest path augmentation ..." << std::endl; |
124 std::cout << "on-the-fly shortest path augmentation ..." << std::endl; |
174 FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0); |
125 FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0); |
175 ts.reset(); |
126 ts.reset(); |