Changeset 630:9ea585de06ea in lemon-0.x for src
- Timestamp:
- 05/13/04 12:29:19 (21 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@821
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/test/mincostflows_test.cc
r611 r630 59 59 length.set(v2_v4, 5); 60 60 length.set(v2_v5, 1); 61 length.set(v3_v5, 5);61 length.set(v3_v5, 4); 62 62 length.set(v4_t, 8); 63 63 length.set(v5_t, 8); 64 64 65 ConstMap<Edge, int> const1map(1); 65 ListGraph::EdgeMap<int> capacity(graph); 66 67 capacity.set(s_v1, 2); 68 capacity.set(v1_v2, 2); 69 capacity.set(s_v3, 1); 70 capacity.set(v2_v4, 1); 71 capacity.set(v2_v5, 1); 72 capacity.set(v3_v5, 1); 73 capacity.set(v4_t, 1); 74 capacity.set(v5_t, 2); 75 76 // ConstMap<Edge, int> const1map(1); 66 77 std::cout << "Mincostflows algorithm test..." << std::endl; 67 78 68 69 int k=3; 70 MinCostFlows< ListGraph, ListGraph::EdgeMap<int>, ConstMap<Edge, int> > 71 surb_test(graph, length, const1map); 79 MinCostFlows< ListGraph, ListGraph::EdgeMap<int>, ListGraph::EdgeMap<int> > 80 surb_test(graph, length, capacity); 72 81 73 check( surb_test.run(s,t,k) == 2 && surb_test.totalLength() == 46,"Two paths, total length should be 46");82 int k=1; 74 83 75 check(surb_test.checkComplementarySlackness(), "Is the primal-dual solution pair really optimal?");76 77 k=1;78 84 check( surb_test.run(s,t,k) == 1 && surb_test.totalLength() == 19,"One path, total length should be 19"); 79 85 80 86 check(surb_test.checkComplementarySlackness(), "Is the primal-dual solution pair really optimal?"); 81 87 88 k=2; 89 90 check( surb_test.run(s,t,k) == 2 && surb_test.totalLength() == 41,"Two paths, total length should be 41"); 91 92 check(surb_test.checkComplementarySlackness(), "Is the primal-dual solution pair really optimal?"); 93 94 95 k=4; 96 97 check( surb_test.run(s,t,k) == 3 && surb_test.totalLength() == 64,"Three paths, total length should be 64"); 98 99 check(surb_test.checkComplementarySlackness(), "Is the primal-dual solution pair really optimal?"); 100 82 101 83 102 cout << (passed ? "All tests passed." : "Some of the tests failed!!!")
Note: See TracChangeset
for help on using the changeset viewer.