src/work/marci/experiment/edmonds_karp_demo_1.cc
changeset 1246 925002e098e7
parent 921 818510fa3d99
equal deleted inserted replaced
1:b50af059e65f 2:70a732031ea5
   102     EMW cw(cap);
   102     EMW cw(cap);
   103     MaxFlow<GW, int, GW::EdgeMap<int>, EMW > max_flow_test(gw, s, t, flow, cw);
   103     MaxFlow<GW, int, GW::EdgeMap<int>, EMW > max_flow_test(gw, s, t, flow, cw);
   104     int i=0;
   104     int i=0;
   105     while (max_flow_test.augmentOnBlockingFlow<MutableGraph>()) { 
   105     while (max_flow_test.augmentOnBlockingFlow<MutableGraph>()) { 
   106 //     for(EdgeIt e=G.template first<EdgeIt>(); e.valid(); ++e) { 
   106 //     for(EdgeIt e=G.template first<EdgeIt>(); e.valid(); ++e) { 
   107 //       std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
   107 //       std::cout<<"("<<G.source(e)<< "-"<<flow.get(e)<<"->"<<G.target(e)<<") ";
   108 //     }
   108 //     }
   109 //     std::cout<<std::endl;
   109 //     std::cout<<std::endl;
   110       ++i; 
   110       ++i; 
   111     }
   111     }
   112 
   112 
   113 //   std::cout << "maximum flow: "<< std::endl;
   113 //   std::cout << "maximum flow: "<< std::endl;
   114 //   for(EdgeIt e=G.first<EdgeIt>(); e.valid(); ++e) { 
   114 //   for(EdgeIt e=G.first<EdgeIt>(); e.valid(); ++e) { 
   115 //     std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
   115 //     std::cout<<"("<<G.source(e)<< "-"<<flow.get(e)<<"->"<<G.target(e)<<") ";
   116 //   }
   116 //   }
   117 //   std::cout<<std::endl;
   117 //   std::cout<<std::endl;
   118     std::cout << "elapsed time: " << ts << std::endl;
   118     std::cout << "elapsed time: " << ts << std::endl;
   119     std::cout << "number of augmentation phases: " << i << std::endl; 
   119     std::cout << "number of augmentation phases: " << i << std::endl; 
   120     std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
   120     std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
   133     EMW cw(cap);
   133     EMW cw(cap);
   134     MaxFlow<GW, int, GW::EdgeMap<int>, EMW > max_flow_test(gw, s, t, flow, cw);
   134     MaxFlow<GW, int, GW::EdgeMap<int>, EMW > max_flow_test(gw, s, t, flow, cw);
   135     int i=0;
   135     int i=0;
   136     while (max_flow_test.augmentOnBlockingFlow1<MutableGraph>()) { 
   136     while (max_flow_test.augmentOnBlockingFlow1<MutableGraph>()) { 
   137 //     for(EdgeIt e=G.template first<EdgeIt>(); e.valid(); ++e) { 
   137 //     for(EdgeIt e=G.template first<EdgeIt>(); e.valid(); ++e) { 
   138 //       std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
   138 //       std::cout<<"("<<G.source(e)<< "-"<<flow.get(e)<<"->"<<G.target(e)<<") ";
   139 //     }
   139 //     }
   140 //     std::cout<<std::endl;
   140 //     std::cout<<std::endl;
   141       ++i; 
   141       ++i; 
   142     }
   142     }
   143 
   143 
   144 //   std::cout << "maximum flow: "<< std::endl;
   144 //   std::cout << "maximum flow: "<< std::endl;
   145 //   for(EdgeIt e=G.first<EdgeIt>(); e.valid(); ++e) { 
   145 //   for(EdgeIt e=G.first<EdgeIt>(); e.valid(); ++e) { 
   146 //     std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
   146 //     std::cout<<"("<<G.source(e)<< "-"<<flow.get(e)<<"->"<<G.target(e)<<") ";
   147 //   }
   147 //   }
   148 //   std::cout<<std::endl;
   148 //   std::cout<<std::endl;
   149     std::cout << "elapsed time: " << ts << std::endl;
   149     std::cout << "elapsed time: " << ts << std::endl;
   150     std::cout << "number of augmentation phases: " << i << std::endl; 
   150     std::cout << "number of augmentation phases: " << i << std::endl; 
   151     std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
   151     std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
   164     EMW cw(cap);
   164     EMW cw(cap);
   165     MaxFlow<GW, int, GW::EdgeMap<int>, EMW > max_flow_test(gw, s, t, flow, cw);
   165     MaxFlow<GW, int, GW::EdgeMap<int>, EMW > max_flow_test(gw, s, t, flow, cw);
   166     int i=0;
   166     int i=0;
   167     while (max_flow_test.augmentOnBlockingFlow2()) { 
   167     while (max_flow_test.augmentOnBlockingFlow2()) { 
   168 //     for(EdgeIt e=G.template first<EdgeIt>(); e.valid(); ++e) { 
   168 //     for(EdgeIt e=G.template first<EdgeIt>(); e.valid(); ++e) { 
   169 //       std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
   169 //       std::cout<<"("<<G.source(e)<< "-"<<flow.get(e)<<"->"<<G.target(e)<<") ";
   170 //     }
   170 //     }
   171 //     std::cout<<std::endl;
   171 //     std::cout<<std::endl;
   172       ++i; 
   172       ++i; 
   173     }
   173     }
   174 
   174 
   175 //   std::cout << "maximum flow: "<< std::endl;
   175 //   std::cout << "maximum flow: "<< std::endl;
   176 //   for(EdgeIt e=G.first<EdgeIt>(); e.valid(); ++e) { 
   176 //   for(EdgeIt e=G.first<EdgeIt>(); e.valid(); ++e) { 
   177 //     std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
   177 //     std::cout<<"("<<G.source(e)<< "-"<<flow.get(e)<<"->"<<G.target(e)<<") ";
   178 //   }
   178 //   }
   179 //   std::cout<<std::endl;
   179 //   std::cout<<std::endl;
   180     std::cout << "elapsed time: " << ts << std::endl;
   180     std::cout << "elapsed time: " << ts << std::endl;
   181     std::cout << "number of augmentation phases: " << i << std::endl; 
   181     std::cout << "number of augmentation phases: " << i << std::endl; 
   182     std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
   182     std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
   195     EMW cw(cap);
   195     EMW cw(cap);
   196     MaxFlow<GW, int, GW::EdgeMap<int>, EMW> max_flow_test(gw, s, t, flow, cw);
   196     MaxFlow<GW, int, GW::EdgeMap<int>, EMW> max_flow_test(gw, s, t, flow, cw);
   197     int i=0;
   197     int i=0;
   198     while (max_flow_test.augmentOnShortestPath()) { 
   198     while (max_flow_test.augmentOnShortestPath()) { 
   199 //     for(EdgeIt e=G.template first<EdgeIt>(); e.valid(); ++e) { 
   199 //     for(EdgeIt e=G.template first<EdgeIt>(); e.valid(); ++e) { 
   200 //       std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
   200 //       std::cout<<"("<<G.source(e)<< "-"<<flow.get(e)<<"->"<<G.target(e)<<") ";
   201 //     }
   201 //     }
   202 //     std::cout<<std::endl;
   202 //     std::cout<<std::endl;
   203       ++i; 
   203       ++i; 
   204     }
   204     }
   205 
   205 
   206 //   std::cout << "maximum flow: "<< std::endl;
   206 //   std::cout << "maximum flow: "<< std::endl;
   207 //   for(EdgeIt e=G.first<EdgeIt>(); e.valid(); ++e) { 
   207 //   for(EdgeIt e=G.first<EdgeIt>(); e.valid(); ++e) { 
   208 //     std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
   208 //     std::cout<<"("<<G.source(e)<< "-"<<flow.get(e)<<"->"<<G.target(e)<<") ";
   209 //   }
   209 //   }
   210 //   std::cout<<std::endl;
   210 //   std::cout<<std::endl;
   211     std::cout << "elapsed time: " << ts << std::endl;
   211     std::cout << "elapsed time: " << ts << std::endl;
   212     std::cout << "number of augmentation phases: " << i << std::endl; 
   212     std::cout << "number of augmentation phases: " << i << std::endl; 
   213     std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
   213     std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;