Changeset 642:e812963087f0 in lemon-0.x for src/work/marci/lg_vs_sg.cc
- Timestamp:
- 05/14/04 20:28:57 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@840
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/work/marci/lg_vs_sg.cc
r640 r642 4 4 #include <string> 5 5 6 #include <list_graph.h> 6 #include <sage_graph.h> 7 #include <hugo/list_graph.h> 7 8 #include <hugo/smart_graph.h> 8 9 #include <hugo/dimacs.h> … … 19 20 20 21 std::string in=argv[1]; 21 typedef ListGraph MutableGraph;22 typedef SageGraph MutableGraph; 22 23 23 24 { 24 typedef ListGraph Graph;25 typedef SageGraph Graph; 25 26 typedef Graph::Node Node; 26 27 typedef Graph::EdgeIt EdgeIt; … … 38 39 max_flow_test(g, s, t, cap, flow/*, true*/); 39 40 40 std::cout << " ListGraph ..." << std::endl;41 std::cout << "SageGraph ..." << std::endl; 41 42 42 43 { … … 93 94 } 94 95 95 96 96 { 97 97 typedef SmartGraph Graph; … … 113 113 // max_flow_test(g, s, t, cap, flow); 114 114 115 std::cout << "Sma trGraph ..." << std::endl;115 std::cout << "SmartGraph ..." << std::endl; 116 116 117 117 { … … 169 169 } 170 170 171 { 172 typedef ListGraph Graph; 173 typedef Graph::Node Node; 174 typedef Graph::EdgeIt EdgeIt; 175 176 Graph g; 177 Node s, t; 178 Graph::EdgeMap<int> cap(g); 179 std::ifstream ins(in.c_str()); 180 //readDimacsMaxFlow(ins, g, s, t, cap); 181 readDimacs(ins, g, cap, s, t); 182 183 Timer ts; 184 Graph::EdgeMap<int> flow(g); //0 flow 185 MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > 186 max_flow_test(g, s, t, cap, flow/*, true*/); 187 // MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > 188 // max_flow_test(g, s, t, cap, flow); 189 190 std::cout << "ListGraph ..." << std::endl; 191 192 { 193 std::cout << "preflow ..." << std::endl; 194 FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0); 195 ts.reset(); 196 max_flow_test.run(); 197 std::cout << "elapsed time: " << ts << std::endl; 198 std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl; 199 } 200 201 { 202 std::cout << "physical blocking flow augmentation ..." << std::endl; 203 FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0); 204 ts.reset(); 205 int i=0; 206 while (max_flow_test.augmentOnBlockingFlow<MutableGraph>()) { ++i; } 207 std::cout << "elapsed time: " << ts << std::endl; 208 std::cout << "number of augmentation phases: " << i << std::endl; 209 std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl; 210 } 211 212 // { 213 // std::cout << "faster physical blocking flow augmentation ..." << std::endl; 214 // FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0); 215 // ts.reset(); 216 // int i=0; 217 // while (max_flow_test.augmentOnBlockingFlow1<MutableGraph>()) { ++i; } 218 // std::cout << "elapsed time: " << ts << std::endl; 219 // std::cout << "number of augmentation phases: " << i << std::endl; 220 // std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl; 221 // } 222 223 { 224 std::cout << "on-the-fly blocking flow augmentation ..." << std::endl; 225 FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0); 226 ts.reset(); 227 int i=0; 228 while (max_flow_test.augmentOnBlockingFlow2()) { ++i; } 229 std::cout << "elapsed time: " << ts << std::endl; 230 std::cout << "number of augmentation phases: " << i << std::endl; 231 std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl; 232 } 233 234 { 235 std::cout << "on-the-fly shortest path augmentation ..." << std::endl; 236 FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0); 237 ts.reset(); 238 int i=0; 239 while (max_flow_test.augmentOnShortestPath()) { ++i; } 240 std::cout << "elapsed time: " << ts << std::endl; 241 std::cout << "number of augmentation phases: " << i << std::endl; 242 std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl; 243 } 244 } 245 171 246 172 247
Note: See TracChangeset
for help on using the changeset viewer.