[Lemon-commits] [lemon_svn] athos: r821 - hugo/trunk/src/test
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:41:40 CET 2006
Author: athos
Date: Thu May 13 12:29:19 2004
New Revision: 821
Modified:
hugo/trunk/src/test/mincostflows_test.cc
Log:
I modified mincostflows_test.cc a little.
Modified: hugo/trunk/src/test/mincostflows_test.cc
==============================================================================
--- hugo/trunk/src/test/mincostflows_test.cc (original)
+++ hugo/trunk/src/test/mincostflows_test.cc Thu May 13 12:29:19 2004
@@ -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<Edge, int> const1map(1);
- std::cout << "Mincostflows algorithm test..." << std::endl;
+ ListGraph::EdgeMap<int> capacity(graph);
-
- int k=3;
- MinCostFlows< ListGraph, ListGraph::EdgeMap<int>, ConstMap<Edge, int> >
- surb_test(graph, length, const1map);
+ 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);
- check( surb_test.run(s,t,k) == 2 && surb_test.totalLength() == 46,"Two paths, total length should be 46");
+ // ConstMap<Edge, int> const1map(1);
+ std::cout << "Mincostflows algorithm test..." << std::endl;
- check(surb_test.checkComplementarySlackness(), "Is the primal-dual solution pair really optimal?");
+ MinCostFlows< ListGraph, ListGraph::EdgeMap<int>, ListGraph::EdgeMap<int> >
+ surb_test(graph, length, capacity);
+
+ int k=1;
- 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;
More information about the Lemon-commits
mailing list