Changeset 941:186aa53d2802 in lemon0.x for src/test
 Timestamp:
 10/08/04 15:07:51 (19 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@1283
 Location:
 src/test
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

src/test/min_cost_flow_test.cc
r921 r941 22 22 //#include <maps.h> 23 23 24 using namespace std;25 24 using namespace lemon; 26 27 25 28 26 … … 42 40 int main() 43 41 { 42 typedef ListGraph Graph; 43 typedef Graph::Node Node; 44 typedef Graph::Edge Edge; 44 45 45 typedef ListGraph::Node Node; 46 typedef ListGraph::Edge Edge; 47 48 ListGraph graph; 46 Graph graph; 49 47 50 48 //Ahuja könyv példája … … 68 66 69 67 70 ListGraph::EdgeMap<int> length(graph);68 Graph::EdgeMap<int> length(graph); 71 69 72 70 length.set(s_v1, 6); … … 79 77 length.set(v5_t, 8); 80 78 81 ListGraph::EdgeMap<int> capacity(graph);79 Graph::EdgeMap<int> capacity(graph); 82 80 83 81 capacity.set(s_v1, 2); … … 93 91 std::cout << "Mincostflows algorithm test..." << std::endl; 94 92 95 MinCostFlow< ListGraph, ListGraph::EdgeMap<int>, ListGraph::EdgeMap<int> >96 surb_test(graph, length, capacity );93 MinCostFlow< Graph, Graph::EdgeMap<int>, Graph::EdgeMap<int> > 94 surb_test(graph, length, capacity, s, t); 97 95 98 96 int k=1; 99 97 100 check( surb_test.run(s,t,k) == 1 && surb_test.totalLength() == 19,"One path, total length should be 19"); 98 surb_test.augment(); 99 check( surb_test.flowValue() == 1 && surb_test.totalLength() == 19,"One path, total length should be 19"); 100 101 check( surb_test.run(k) == 1 && surb_test.totalLength() == 19,"One path, total length should be 19"); 101 102 102 103 check(surb_test.checkComplementarySlackness(), "Is the primaldual solution pair really optimal?"); … … 104 105 k=2; 105 106 106 check( surb_test.run( s,t,k) == 2 && surb_test.totalLength() == 41,"Two paths, total length should be 41");107 check( surb_test.run(k) == 2 && surb_test.totalLength() == 41,"Two paths, total length should be 41"); 107 108 108 109 check(surb_test.checkComplementarySlackness(), "Is the primaldual solution pair really optimal?"); 109 110 110 111 surb_test.augment(); 112 surb_test.augment(); 113 surb_test.augment(); 111 114 k=4; 112 115 113 check( surb_test.run( s,t,k) == 3 && surb_test.totalLength() == 64,"Three paths, total length should be 64");116 check( surb_test.run(k) == 3 && surb_test.totalLength() == 64,"Three paths, total length should be 64"); 114 117 115 118 check(surb_test.checkComplementarySlackness(), "Is the primaldual solution pair really optimal?"); 116 119 117 120 118 cout << (passed ? "All tests passed." : "Some of the tests failed!!!")119 <<endl;121 std::cout << (passed ? "All tests passed." : "Some of the tests failed!!!") 122 << std::endl; 120 123 121 124 return passed ? 0 : 1; 
src/test/suurballe_test.cc
r921 r941 21 21 #include "test_tools.h" 22 22 23 using namespace std;24 23 using namespace lemon; 25 26 24 27 25 … … 31 29 int main() 32 30 { 31 typedef ListGraph Graph; 32 typedef Graph::Node Node; 33 typedef Graph::Edge Edge; 33 34 34 typedef ListGraph::Node Node; 35 typedef ListGraph::Edge Edge; 36 37 ListGraph graph; 35 Graph graph; 38 36 39 37 //Ahuja könyv példája … … 57 55 58 56 59 ListGraph::EdgeMap<int> length(graph);57 Graph::EdgeMap<int> length(graph); 60 58 61 59 length.set(s_v1, 6); … … 72 70 73 71 int k=3; 74 Suurballe< ListGraph, ListGraph::EdgeMap<int> >75 surb_test(graph, length );72 Suurballe< Graph, Graph::EdgeMap<int> > 73 surb_test(graph, length, s, t); 76 74 77 check( surb_test.run( s,t,k) == 2 && surb_test.totalLength() == 46,75 check( surb_test.run(k) == 2 && surb_test.totalLength() == 46, 78 76 "Two paths, total length should be 46"); 79 77 … … 81 79 "Complementary slackness conditions are not met."); 82 80 83 // typedef DirPath< ListGraph> DPath;81 // typedef DirPath<Graph> DPath; 84 82 // DPath P(graph); 85 83 … … 87 85 surb_test.getPath(P,0); 88 86 check(P.length() == 4, "First path should contain 4 edges."); 89 cout<<P.length()<<endl;87 std::cout<<P.length()<<std::endl; 90 88 surb_test.getPath(P,1); 91 89 check(P.length() == 3, "Second path: 3 edges."); 92 cout<<P.length()<<endl;90 std::cout<<P.length()<<std::endl; 93 91 */ 94 92 95 93 k=1; 96 check( surb_test.run( s,t,k) == 1 && surb_test.totalLength() == 19,94 check( surb_test.run(k) == 1 && surb_test.totalLength() == 19, 97 95 "One path, total length should be 19"); 98 96 … … 103 101 // check(P.length() == 4, "First path should contain 4 edges."); 104 102 105 cout << (passed ? "All tests passed." : "Some of the tests failed!!!")106 <<endl;103 std::cout << (passed ? "All tests passed." : "Some of the tests failed!!!") 104 << std::endl; 107 105 108 106 return passed ? 0 : 1;
Note: See TracChangeset
for help on using the changeset viewer.