#include #include #include #include #include #include const char test_name[] = "circulation"; using namespace lemon; int main(int argc, char **argv) { if(argc!=2) exit(1); 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 { std::ifstream input; input.open(argv[1]); readDimacsMin(input, g, lo_cap, up_cap, cost, sup); } catch (FormatError& error) { std::cerr << error.what() << std::endl; return 1; } std::cerr << "Read the file: " << ti << '\n'; ti.restart(); Circulation,SmartDigraph::ArcMap, SmartDigraph::NodeMap > circ(g,lo_cap,up_cap,sup); std::cerr << "Setup Circulation class: " << ti << '\n'; ti.restart(); bool res = circ.run(); if(res) { std::cerr << "A feasible circulation is found: " << ti << "\n"; ti.restart(); bool res2 = circ.checkFlow(); std::cerr << "Checked in time " << ti << "\n"; if(res2) std::cerr << "Success!\nn"; else std::cerr << "Oops!!!!\n\n"; } else { std::cerr << "A dual solution is found: " << ti << "\n"; ti.restart(); bool res2 = circ.checkBarrier(); std::cerr << "Checked in time " << ti << "\n"; if(res2) std::cerr << "Success!\nn"; else std::cerr << "Dual-Oops!!!!\n\n"; } }