.
     5 #include <list_graph.h>
 
     6 #include <smart_graph.h>
 
     8 #include <edmonds_karp.h>
 
     9 #include <time_measure.h>
 
    10 #include <graph_wrapper.h>
 
    14 // Use a DIMACS max flow file as stdin.
 
    15 // read_dimacs_demo < dimacs_max_flow_file
 
    25 //   template <typename B>
 
    33 int main(int, char **) {
 
    35   typedef ListGraph MutableGraph;
 
    37   typedef SmartGraph Graph;
 
    38   typedef Graph::Node Node;
 
    39   typedef Graph::EdgeIt EdgeIt;
 
    45 //   typedef Mize Tize[0];
 
    47 //   std::cout << &zize << " " << sizeof(mize) << sizeof(Tize) << std::endl;
 
    48 //   std::cout << sizeof(bize) << std::endl;
 
    52 //   std::cout << sizeof(k) << std::endl;
 
    60 //   std::cout << sizeof(Bumm) << std::endl;
 
    65   Graph::EdgeMap<int> cap(G);
 
    66   readDimacsMaxFlow(std::cin, G, s, t, cap);
 
    68 //   typedef TrivGraphWrapper<Graph> TGW;
 
    71 //   gw./*getF*/first(sw);
 
    72 //   std::cout << "p1:" << gw.nodeNum() << std::endl;
 
    74 //   std::cout << "p2:" << gw.nodeNum() << std::endl;
 
    76 //   typedef const Graph cLG;
 
    77 //   typedef TrivGraphWrapper<const cLG> CTGW;
 
    80 //   cgw./*getF*/first(csw);
 
    81 //   std::cout << "p1:" << cgw.nodeNum() << std::endl;
 
    83 //   std::cout << "p2:" << cgw.nodeNum() << std::endl;
 
    87     std::cout << "SmartGraph..." << std::endl;
 
    88     std::cout << "edmonds karp demo (physical blocking flow augmentation)..." << std::endl;
 
    89     Graph::EdgeMap<int> flow(G); //0 flow
 
    94     MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > max_flow_test(G, s, t, flow, cap);
 
    95     //max_flow_test.augmentWithBlockingFlow<Graph>();
 
    97     while (max_flow_test.augmentOnBlockingFlow<MutableGraph>()) { 
 
    98 //     for(EdgeIt e=G.template first<EdgeIt>(); e.valid(); ++e) { 
 
    99 //       std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
 
   101 //     std::cout<<std::endl;
 
   105 //   std::cout << "maximum flow: "<< std::endl;
 
   106 //   for(EdgeIt e=G.first<EdgeIt>(); e.valid(); ++e) { 
 
   107 //     std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
 
   109 //   std::cout<<std::endl;
 
   110     std::cout << "elapsed time: " << ts << std::endl;
 
   111     std::cout << "number of augmentation phases: " << i << std::endl; 
 
   112     std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
 
   116     std::cout << "edmonds karp demo (on-the-fly blocking flow augmentation)..." << std::endl;
 
   117     Graph::EdgeMap<int> flow(G); //0 flow
 
   122     MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > max_flow_test(G, s, t, flow, cap);
 
   123     //max_flow_test.augmentWithBlockingFlow<Graph>();
 
   125     while (max_flow_test.augmentOnBlockingFlow2()) { 
 
   126 //     for(EdgeIt e=G.template first<EdgeIt>(); e.valid(); ++e) { 
 
   127 //       std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
 
   129 //     std::cout<<std::endl;
 
   133 //   std::cout << "maximum flow: "<< std::endl;
 
   134 //   for(EdgeIt e=G.first<EdgeIt>(); e.valid(); ++e) { 
 
   135 //     std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
 
   137 //   std::cout<<std::endl;
 
   138     std::cout << "elapsed time: " << ts << std::endl;
 
   139     std::cout << "number of augmentation phases: " << i << std::endl; 
 
   140     std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
 
   144     std::cout << "edmonds karp demo (on-the-fly shortest path augmentation)..." << std::endl;
 
   145     Graph::EdgeMap<int> flow(G); //0 flow
 
   150     MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > max_flow_test(G, s, t, flow, cap);
 
   151     //max_flow_test.augmentWithBlockingFlow<Graph>();
 
   153     while (max_flow_test.augmentOnShortestPath()) { 
 
   154 //     for(EdgeIt e=G.template first<EdgeIt>(); e.valid(); ++e) { 
 
   155 //       std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
 
   157 //     std::cout<<std::endl;
 
   161 //   std::cout << "maximum flow: "<< std::endl;
 
   162 //   for(EdgeIt e=G.first<EdgeIt>(); e.valid(); ++e) { 
 
   163 //     std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
 
   165 //   std::cout<<std::endl;
 
   166     std::cout << "elapsed time: " << ts << std::endl;
 
   167     std::cout << "number of augmentation phases: " << i << std::endl; 
 
   168     std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;