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

 1 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;
Note: See TracChangeset
for help on using the changeset viewer.