// -*- c++ -*- #include #include #include #include #include #include #include #include class CM { public: template int get(T) const {return 1;} }; using namespace hugo; // Use a DIMACS max flow file as stdin. // read_dimacs_demo < dimacs_max_flow_file // struct Ize { // }; // struct Mize { // Ize bumm; // }; // template // class Huha { // public: // int u; // B brr; // }; int main(int, char **) { typedef ListGraph MutableGraph; //typedef SmartGraph Graph; typedef ListGraph Graph; typedef Graph::Node Node; typedef Graph::EdgeIt EdgeIt; // Mize mize[10]; // Mize bize[0]; // Mize zize; // typedef Mize Tize[0]; // std::cout << &zize << " " << sizeof(mize) << sizeof(Tize) << std::endl; // std::cout << sizeof(bize) << std::endl; // Huha k; // std::cout << sizeof(k) << std::endl; // struct Bumm { // //int a; // bool b; // }; // std::cout << sizeof(Bumm) << std::endl; Graph G; Node s, t; Graph::EdgeMap cap(G); readDimacsMaxFlow(std::cin, G, s, t, cap); // typedef TrivGraphWrapper TGW; // TGW gw(G); // TGW::NodeIt sw; // gw./*getF*/first(sw); // std::cout << "p1:" << gw.nodeNum() << std::endl; // gw.erase(sw); // std::cout << "p2:" << gw.nodeNum() << std::endl; // typedef const Graph cLG; // typedef TrivGraphWrapper CTGW; // CTGW cgw(G); // CTGW::NodeIt csw; // cgw./*getF*/first(csw); // std::cout << "p1:" << cgw.nodeNum() << std::endl; // //cgw.erase(csw); // std::cout << "p2:" << cgw.nodeNum() << std::endl; { //std::cout << "SmartGraph..." << std::endl; typedef TrivGraphWrapper GW; GW gw(G); std::cout << "edmonds karp demo (physical blocking flow augmentation)..." << std::endl; GW::EdgeMap flow(G); //0 flow Timer ts; ts.reset(); typedef GW::EdgeMapWrapper< Graph::EdgeMap, int > EMW; EMW cw(cap); MaxFlow, EMW > max_flow_test(gw, s, t, flow, cw); int i=0; while (max_flow_test.augmentOnBlockingFlow()) { // for(EdgeIt e=G.template first(); e.valid(); ++e) { // std::cout<<"("<"<(); e.valid(); ++e) { // std::cout<<"("<"< GW; GW gw(G); std::cout << "edmonds karp demo (physical blocking flow 1 augmentation)..." << std::endl; GW::EdgeMap flow(G); //0 flow Timer ts; ts.reset(); typedef GW::EdgeMapWrapper< Graph::EdgeMap, int > EMW; EMW cw(cap); MaxFlow, EMW > max_flow_test(gw, s, t, flow, cw); int i=0; while (max_flow_test.augmentOnBlockingFlow1()) { // for(EdgeIt e=G.template first(); e.valid(); ++e) { // std::cout<<"("<"<(); e.valid(); ++e) { // std::cout<<"("<"< flow(G); //0 flow // Timer ts; // ts.reset(); // MaxFlow, Graph::EdgeMap > max_flow_test(G, s, t, flow, cap); // int i=0; // while (max_flow_test.augmentOnBlockingFlow2()) { // // for(EdgeIt e=G.template first(); e.valid(); ++e) { // // std::cout<<"("<"<(); e.valid(); ++e) { // // std::cout<<"("<"< GW; GW gw(G); std::cout << "edmonds karp demo (on-the-fly shortest path augmentation)..." << std::endl; GW::EdgeMap flow(gw); //0 flow Timer ts; ts.reset(); //CM cm; typedef GW::EdgeMapWrapper< Graph::EdgeMap, int > EMW; EMW cw(cap); MaxFlow, EMW> max_flow_test(gw, s, t, flow, cw); int i=0; while (max_flow_test.augmentOnShortestPath()) { // for(EdgeIt e=G.template first(); e.valid(); ++e) { // std::cout<<"("<"<(); e.valid(); ++e) { // std::cout<<"("<"<