59 length.set(v2_v5, 1); |
59 length.set(v2_v5, 1); |
60 length.set(v3_v5, 5); |
60 length.set(v3_v5, 5); |
61 length.set(v4_t, 8); |
61 length.set(v4_t, 8); |
62 length.set(v5_t, 8); |
62 length.set(v5_t, 8); |
63 |
63 |
64 ConstMap const1map(1); |
64 ConstMap<Edge, int> const1map(1); |
65 std::cout << "Minlengthpaths algorithm test..." << std::endl; |
65 std::cout << "Mincostflows algorithm test..." << std::endl; |
66 |
66 |
67 |
67 |
68 int k=3; |
68 int k=3; |
69 MinCostFlows< ListGraph, ListGraph::EdgeMap<int> > |
69 MinCostFlows< ListGraph, ListGraph::EdgeMap<int>, ConstMap<Edge, int> > |
70 surb_test(graph, length, const1map); |
70 surb_test(graph, length, const1map); |
71 |
71 |
72 check( surb_test.run(s,t,k) == 2 && surb_test.totalLength() == 46,"Two paths, total length should be 46"); |
72 check( surb_test.run(s,t,k) == 2 && surb_test.totalLength() == 46,"Two paths, total length should be 46"); |
73 |
73 |
|
74 k=1; |
|
75 check( surb_test.run(s,t,k) == 1 && surb_test.totalLength() == 19,"One path, total length should be 19"); |
|
76 |
|
77 //cout << surb_test.run(s,t,k) << surb_test.totalLength()<<endl; |
|
78 /* |
74 typedef DirPath<ListGraph> DPath; |
79 typedef DirPath<ListGraph> DPath; |
75 DPath P(graph); |
80 DPath P(graph); |
76 |
81 |
77 surb_test.getPath(P,0); |
82 surb_test.getPath(P,0); |
78 check(P.length() == 4, "First path should contain 4 edges."); |
83 check(P.length() == 4, "First path should contain 4 edges."); |
83 k=1; |
88 k=1; |
84 check( surb_test.run(s,t,k) == 1 && surb_test.totalLength() == 19,"One path, total length should be 19"); |
89 check( surb_test.run(s,t,k) == 1 && surb_test.totalLength() == 19,"One path, total length should be 19"); |
85 |
90 |
86 surb_test.getPath(P,0); |
91 surb_test.getPath(P,0); |
87 check(P.length() == 4, "First path should contain 4 edges."); |
92 check(P.length() == 4, "First path should contain 4 edges."); |
88 |
93 */ |
89 cout << (passed ? "All tests passed." : "Some of the tests failed!!!") |
94 cout << (passed ? "All tests passed." : "Some of the tests failed!!!") |
90 << endl; |
95 << endl; |
91 |
96 |
92 return passed ? 0 : 1; |
97 return passed ? 0 : 1; |
93 |
98 |