marci@615: // -*- c++ -*- marci@615: #include marci@615: #include marci@615: marci@615: #include marci@615: #include marci@615: #include marci@615: #include marci@615: //#include marci@615: #include marci@615: //#include marci@640: #include marci@615: marci@615: using namespace hugo; marci@615: marci@615: // Use a DIMACS max flow file as stdin. marci@615: // read_dimacs_demo < dimacs_max_flow_file marci@615: marci@615: marci@615: int main(int, char **) { marci@615: marci@615: typedef ListGraph MutableGraph; marci@615: marci@615: typedef SmartGraph Graph; marci@615: // typedef ListGraph Graph; marci@615: typedef Graph::Node Node; marci@615: typedef Graph::EdgeIt EdgeIt; marci@615: marci@615: marci@615: Graph g; marci@615: Node s, t; marci@615: Graph::EdgeMap cap(g); marci@615: //readDimacsMaxFlow(std::cin, g, s, t, cap); marci@615: readDimacs(std::cin, g, cap, s, t); marci@615: Timer ts; marci@615: Graph::EdgeMap flow(g); //0 flow marci@615: MaxFlow, Graph::EdgeMap > marci@615: max_flow_test(g, s, t, cap, flow); marci@615: marci@615: { marci@615: std::cout << "preflow ..." << std::endl; marci@615: FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0); marci@615: ts.reset(); jacint@629: max_flow_test.preflowPhase1(MaxFlow, Graph::EdgeMap >::ZERO_FLOW); marci@615: std::cout << "elapsed time: " << ts << std::endl; marci@615: std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl; marci@615: } marci@615: marci@615: { marci@615: std::cout << "preflow ..." << std::endl; marci@615: FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0); marci@615: ts.reset(); jacint@629: max_flow_test.preflowPhase1(MaxFlow, Graph::EdgeMap >::ZERO_FLOW); marci@615: std::cout << "elapsed time: " << ts << std::endl; marci@615: std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl; marci@615: } marci@615: marci@615: marci@615: return 0; marci@615: }