Changeset 854:baf0b6e40211 in lemon0.x for src/work/marci/max_flow_demo.cc
 Timestamp:
 09/15/04 12:34:12 (19 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@1153
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

src/work/marci/max_flow_demo.cc
r849 r854 4 4 // max_flow_demo < dimacs_max_flow_file 5 5 6 7 6 #include <iostream> 8 7 #include <fstream> 9 8 10 #include <sage_graph.h>11 9 #include <hugo/smart_graph.h> 10 #include <hugo/list_graph.h> 12 11 #include <hugo/dimacs.h> 13 12 #include <hugo/time_measure.h> 14 //#include <graph_wrapper.h>15 13 #include <hugo/preflow.h> 16 14 #include <augmenting_flow.h> 17 //#include <preflow_res.h>18 #include <for_each_macros.h>19 15 #include <graph_concept.h> 20 16 … … 23 19 int main(int, char **) { 24 20 25 typedef SageGraph MutableGraph; 26 27 //typedef FullFeatureGraphConcept Graph; 28 //typedef SmartGraph Graph; 29 typedef SageGraph Graph; 21 typedef ListGraph MutableGraph; 22 typedef SmartGraph Graph; 30 23 typedef Graph::Node Node; 31 24 typedef Graph::EdgeIt EdgeIt; … … 54 47 max_flow_test.minCut(cut); 55 48 56 FOR_EACH_LOC(Graph::EdgeIt, e, g) {49 for(Graph::EdgeIt e(g); e!=INVALID; ++e) { 57 50 if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e]) 58 51 std::cout << "Slackness does not hold!" << std::endl; … … 64 57 { 65 58 std::cout << "preflow ..." << std::endl; 66 FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0);59 for(Graph::EdgeIt e(g); e!=INVALID; ++e) flow.set(e, 0); 67 60 ts.reset(); 68 max_flow_test. preflow(Preflow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> >::GEN_FLOW);61 max_flow_test.run(Preflow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> >::GEN_FLOW); 69 62 std::cout << "elapsed time: " << ts << std::endl; 70 63 std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl; 71 64 72 FOR_EACH_LOC(Graph::EdgeIt, e, g) {65 for(Graph::EdgeIt e(g); e!=INVALID; ++e) { 73 66 if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e]) 74 67 std::cout << "Slackness does not hold!" << std::endl; … … 89 82 { 90 83 std::cout << "physical blocking flow augmentation ..." << std::endl; 91 FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0);84 for(Graph::EdgeIt e(g); e!=INVALID; ++e) flow.set(e, 0); 92 85 ts.reset(); 93 86 int i=0; … … 97 90 std::cout << "flow value: "<< augmenting_flow_test.flowValue() << std::endl; 98 91 99 FOR_EACH_LOC(Graph::EdgeIt, e, g) {92 for(Graph::EdgeIt e(g); e!=INVALID; ++e) { 100 93 if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e]) 101 94 std::cout << "Slackness does not hold!" << std::endl; … … 107 100 { 108 101 std::cout << "onthefly blocking flow augmentation ..." << std::endl; 109 FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0);102 for(Graph::EdgeIt e(g); e!=INVALID; ++e) flow.set(e, 0); 110 103 ts.reset(); 111 104 int i=0; … … 115 108 std::cout << "flow value: "<< augmenting_flow_test.flowValue() << std::endl; 116 109 117 FOR_EACH_LOC(Graph::EdgeIt, e, g) {110 for(Graph::EdgeIt e(g); e!=INVALID; ++e) { 118 111 if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e]) 119 112 std::cout << "Slackness does not hold!" << std::endl; … … 125 118 { 126 119 std::cout << "onthefly shortest path augmentation ..." << std::endl; 127 FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0);120 for(Graph::EdgeIt e(g); e!=INVALID; ++e) flow.set(e, 0); 128 121 ts.reset(); 129 122 int i=0; … … 133 126 std::cout << "flow value: "<< augmenting_flow_test.flowValue() << std::endl; 134 127 135 FOR_EACH_LOC(Graph::EdgeIt, e, g) {128 for(Graph::EdgeIt e(g); e!=INVALID; ++e) { 136 129 if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e]) 137 130 std::cout << "Slackness does not hold!" << std::endl; … … 143 136 { 144 137 std::cout << "onthefly shortest path augmentation ..." << std::endl; 145 FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0);138 for(Graph::EdgeIt e(g); e!=INVALID; ++e) flow.set(e, 0); 146 139 ts.reset(); 147 140 int i=0; … … 151 144 std::cout << "flow value: "<< augmenting_flow_test.flowValue() << std::endl; 152 145 153 FOR_EACH_LOC(Graph::EdgeIt, e, g) {146 for(Graph::EdgeIt e(g); e!=INVALID; ++e) { 154 147 if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e]) 155 148 std::cout << "Slackness does not hold!" << std::endl;
Note: See TracChangeset
for help on using the changeset viewer.