diff -r 50a153b08f07 -r 186aa53d2802 src/test/min_cost_flow_test.cc --- a/src/test/min_cost_flow_test.cc Thu Oct 07 17:21:27 2004 +0000 +++ b/src/test/min_cost_flow_test.cc Fri Oct 08 13:07:51 2004 +0000 @@ -21,11 +21,9 @@ //#include //#include -using namespace std; using namespace lemon; - bool passed = true; /* void check(bool rc, char *msg="") { @@ -41,11 +39,11 @@ int main() { + typedef ListGraph Graph; + typedef Graph::Node Node; + typedef Graph::Edge Edge; - typedef ListGraph::Node Node; - typedef ListGraph::Edge Edge; - - ListGraph graph; + Graph graph; //Ahuja könyv példája @@ -67,7 +65,7 @@ Edge v5_t=graph.addEdge(v5, t); - ListGraph::EdgeMap length(graph); + Graph::EdgeMap length(graph); length.set(s_v1, 6); length.set(v1_v2, 4); @@ -78,7 +76,7 @@ length.set(v4_t, 8); length.set(v5_t, 8); - ListGraph::EdgeMap capacity(graph); + Graph::EdgeMap capacity(graph); capacity.set(s_v1, 2); capacity.set(v1_v2, 2); @@ -92,31 +90,36 @@ // ConstMap const1map(1); std::cout << "Mincostflows algorithm test..." << std::endl; - MinCostFlow< ListGraph, ListGraph::EdgeMap, ListGraph::EdgeMap > - surb_test(graph, length, capacity); + MinCostFlow< Graph, Graph::EdgeMap, Graph::EdgeMap > + surb_test(graph, length, capacity, s, t); int k=1; - check( surb_test.run(s,t,k) == 1 && surb_test.totalLength() == 19,"One path, total length should be 19"); + surb_test.augment(); + check( surb_test.flowValue() == 1 && surb_test.totalLength() == 19,"One path, total length should be 19"); + + check( surb_test.run(k) == 1 && surb_test.totalLength() == 19,"One path, total length should be 19"); check(surb_test.checkComplementarySlackness(), "Is the primal-dual solution pair really optimal?"); k=2; - check( surb_test.run(s,t,k) == 2 && surb_test.totalLength() == 41,"Two paths, total length should be 41"); + check( surb_test.run(k) == 2 && surb_test.totalLength() == 41,"Two paths, total length should be 41"); check(surb_test.checkComplementarySlackness(), "Is the primal-dual solution pair really optimal?"); - + surb_test.augment(); + surb_test.augment(); + surb_test.augment(); k=4; - check( surb_test.run(s,t,k) == 3 && surb_test.totalLength() == 64,"Three paths, total length should be 64"); + check( surb_test.run(k) == 3 && surb_test.totalLength() == 64,"Three paths, total length should be 64"); check(surb_test.checkComplementarySlackness(), "Is the primal-dual solution pair really optimal?"); - cout << (passed ? "All tests passed." : "Some of the tests failed!!!") - << endl; + std::cout << (passed ? "All tests passed." : "Some of the tests failed!!!") + << std::endl; return passed ? 0 : 1;