COIN-OR::LEMON - Graph Library

Ignore:
Timestamp:
03/31/04 17:50:21 (20 years ago)
Author:
marci
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@375
Message:

Working on-the-fly with wrappers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/work/marci/edmonds_karp_demo.cc

    r268 r269  
    9191
    9292  {
    93     //std::cout << "SmartGraph..." << std::endl;
    9493    typedef TrivGraphWrapper<const Graph> GW;
    9594    GW gw(G);
     
    123122
    124123  {
    125     //std::cout << "SmartGraph..." << std::endl;
    126124    typedef TrivGraphWrapper<const Graph> GW;
    127125    GW gw(G);
     
    154152  }
    155153
    156 //   {
    157 //     std::cout << "edmonds karp demo (on-the-fly blocking flow augmentation)..." << std::endl;
    158 //     Graph::EdgeMap<int> flow(G); //0 flow
    159 
    160 //     Timer ts;
    161 //     ts.reset();
    162 
    163 //     MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > max_flow_test(G, s, t, flow, cap);
    164 //     int i=0;
    165 //     while (max_flow_test.augmentOnBlockingFlow2()) {
    166 // //     for(EdgeIt e=G.template first<EdgeIt>(); e.valid(); ++e) {
    167 // //       std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
    168 // //     }
    169 // //     std::cout<<std::endl;
    170 //       ++i;
    171 //     }
    172 
    173 // //   std::cout << "maximum flow: "<< std::endl;
    174 // //   for(EdgeIt e=G.first<EdgeIt>(); e.valid(); ++e) {
    175 // //     std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
    176 // //   }
    177 // //   std::cout<<std::endl;
    178 //     std::cout << "elapsed time: " << ts << std::endl;
    179 //     std::cout << "number of augmentation phases: " << i << std::endl;
    180 //     std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
    181 //   }
     154  {
     155    typedef TrivGraphWrapper<const Graph> GW;
     156    GW gw(G);
     157    std::cout << "edmonds karp demo (on-the-fly blocking flow augmentation)..." << std::endl;
     158    GW::EdgeMap<int> flow(G); //0 flow
     159
     160    Timer ts;
     161    ts.reset();
     162
     163    typedef GW::EdgeMapWrapper< Graph::EdgeMap<int>, int > EMW;
     164    EMW cw(cap);
     165    MaxFlow<GW, int, GW::EdgeMap<int>, EMW > max_flow_test(gw, s, t, flow, cw);
     166    int i=0;
     167    while (max_flow_test.augmentOnBlockingFlow2()) {
     168//     for(EdgeIt e=G.template first<EdgeIt>(); e.valid(); ++e) {
     169//       std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
     170//     }
     171//     std::cout<<std::endl;
     172      ++i;
     173    }
     174
     175//   std::cout << "maximum flow: "<< std::endl;
     176//   for(EdgeIt e=G.first<EdgeIt>(); e.valid(); ++e) {
     177//     std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
     178//   }
     179//   std::cout<<std::endl;
     180    std::cout << "elapsed time: " << ts << std::endl;
     181    std::cout << "number of augmentation phases: " << i << std::endl;
     182    std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
     183  }
    182184
    183185  {
     
    190192    ts.reset();
    191193
    192     //CM cm;
    193194    typedef GW::EdgeMapWrapper< Graph::EdgeMap<int>, int > EMW;
    194195    EMW cw(cap);
Note: See TracChangeset for help on using the changeset viewer.