.
4 #include <list_graph.hh>
6 #include <edmonds_karp.hh>
7 #include <time_measure.h>
8 #include <graph_wrapper.h>
12 // Use a DIMACS max flow file as stdin.
13 // read_dimacs_demo < dimacs_max_flow_file
31 int main(int, char **) {
32 typedef ListGraph::NodeIt NodeIt;
33 typedef ListGraph::EachEdgeIt EachEdgeIt;
41 std::cout << &zize << " " << sizeof(mize) << sizeof(Tize) << std::endl;
42 std::cout << sizeof(bize) << std::endl;
46 std::cout << sizeof(k) << std::endl;
54 std::cout << sizeof(Bumm) << std::endl;
59 ListGraph::EdgeMap<int> cap(G);
60 readDimacsMaxFlow(std::cin, G, s, t, cap);
62 typedef TrivGraphWrapper<ListGraph> TGW;
66 std::cout << "p1:" << gw.nodeNum() << std::endl;
68 std::cout << "p2:" << gw.nodeNum() << std::endl;
70 typedef const ListGraph cLG;
71 typedef TrivGraphWrapper<const cLG> CTGW;
75 std::cout << "p1:" << cgw.nodeNum() << std::endl;
77 std::cout << "p2:" << cgw.nodeNum() << std::endl;
81 std::cout << "edmonds karp demo (blocking flow augmentation)..." << std::endl;
82 ListGraph::EdgeMap<int> flow(G); //0 flow
86 //double pre_time=currTime();
87 MaxFlow<ListGraph, int, ListGraph::EdgeMap<int>, ListGraph::EdgeMap<int> > max_flow_test(G, s, t, flow, cap);
88 //max_flow_test.augmentWithBlockingFlow<ListGraph>();
90 while (max_flow_test.augmentOnBlockingFlow<ListGraph>()) { ++i; }
91 //double post_time=currTime();
93 //std::cout << "maximum flow: "<< std::endl;
94 //for(EachEdgeIt e=G.first<EachEdgeIt>(); e.valid(); ++e) {
95 // std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
97 //std::cout<<std::endl;
98 std::cout << "elapsed time: " << ts << std::endl;
99 std::cout << "number of augmentation phases: " << i << std::endl;
100 std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
104 std::cout << "edmonds karp demo (shortest path augmentation)..." << std::endl;
105 ListGraph::EdgeMap<int> flow(G); //0 flow
109 //double pre_time=currTime();
110 MaxFlow<ListGraph, int, ListGraph::EdgeMap<int>, ListGraph::EdgeMap<int> > max_flow_test(G, s, t, flow, cap);
111 //max_flow_test.augmentWithBlockingFlow<ListGraph>();
113 while (max_flow_test.augmentOnShortestPath()) { ++i; }
114 //double post_time=currTime();
116 //std::cout << "maximum flow: "<< std::endl;
117 //for(EachEdgeIt e=G.first<EachEdgeIt>(); e.valid(); ++e) {
118 // std::cout<<"("<<G.tail(e)<< "-"<<flow.get(e)<<"->"<<G.head(e)<<") ";
120 //std::cout<<std::endl;
121 std::cout << "elapsed time: " << ts << std::endl;
122 std::cout << "number of augmentation phases: " << i << std::endl;
123 std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;