#include #include #include #include #include #include #include std::string test_name = "circulation"; using namespace lemon; int testMain(std::istream &input) { typedef int Value; SmartDigraph g; SmartDigraph::ArcMap lo_cap(g); SmartDigraph::ArcMap up_cap(g); SmartDigraph::ArcMap cost(g); SmartDigraph::NodeMap sup(g); Timer ti; try { readDimacsMin(input, g, lo_cap, up_cap, cost, sup); } catch (FormatError& error) { std::cerr << error.what() << std::endl; return 1; } logTime("fread",ti); Timer tf; ti.restart(); Circulation,SmartDigraph::ArcMap, SmartDigraph::NodeMap > circ(g,lo_cap,up_cap,sup); logTime("setup",ti); ti.restart(); bool res = circ.run(); logTime("alg",ti); logTime("full",tf); if(res) { std::cerr << "A feasible circulation is found\n"; std::cerr << "Checking...\n"; ti.restart(); bool res2 = circ.checkFlow(); logTime("check",ti); if(res2) std::cerr << "Success!\n"; else std::cerr << "Oops!!!!\n"; } else { std::cerr << "A dual solution is found\n"; std::cerr << "Checking...\n"; ti.restart(); bool res2 = circ.checkBarrier(); logTime("check",ti); if(res2) std::cerr << "Success!\n"; else std::cerr << "Dual-Oops!!!!\n"; } }