# HG changeset patch # User athos # Date 1084444159 0 # Node ID 9ea585de06ea2edbcfba5049c67751ee9f9228c5 # Parent 6620dfc606afa2986d3aa1df5cbfc03d289f0569 I modified mincostflows_test.cc a little. diff -r 6620dfc606af -r 9ea585de06ea src/test/mincostflows_test.cc --- a/src/test/mincostflows_test.cc Thu May 13 10:29:13 2004 +0000 +++ b/src/test/mincostflows_test.cc Thu May 13 10:29:19 2004 +0000 @@ -58,27 +58,46 @@ length.set(s_v3, 10); length.set(v2_v4, 5); length.set(v2_v5, 1); - length.set(v3_v5, 5); + length.set(v3_v5, 4); length.set(v4_t, 8); length.set(v5_t, 8); - ConstMap const1map(1); + ListGraph::EdgeMap capacity(graph); + + capacity.set(s_v1, 2); + capacity.set(v1_v2, 2); + capacity.set(s_v3, 1); + capacity.set(v2_v4, 1); + capacity.set(v2_v5, 1); + capacity.set(v3_v5, 1); + capacity.set(v4_t, 1); + capacity.set(v5_t, 2); + + // ConstMap const1map(1); std::cout << "Mincostflows algorithm test..." << std::endl; - - int k=3; - MinCostFlows< ListGraph, ListGraph::EdgeMap, ConstMap > - surb_test(graph, length, const1map); + MinCostFlows< ListGraph, ListGraph::EdgeMap, ListGraph::EdgeMap > + surb_test(graph, length, capacity); - check( surb_test.run(s,t,k) == 2 && surb_test.totalLength() == 46,"Two paths, total length should be 46"); + int k=1; - check(surb_test.checkComplementarySlackness(), "Is the primal-dual solution pair really optimal?"); - - k=1; check( surb_test.run(s,t,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.checkComplementarySlackness(), "Is the primal-dual solution pair really optimal?"); + + + k=4; + + check( surb_test.run(s,t,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;