I modified mincostflows_test.cc a little.
authorathos
Thu, 13 May 2004 10:29:19 +0000
changeset 6309ea585de06ea
parent 629 6620dfc606af
child 631 26819ef1611f
I modified mincostflows_test.cc a little.
src/test/mincostflows_test.cc
     1.1 --- a/src/test/mincostflows_test.cc	Thu May 13 10:29:13 2004 +0000
     1.2 +++ b/src/test/mincostflows_test.cc	Thu May 13 10:29:19 2004 +0000
     1.3 @@ -58,27 +58,46 @@
     1.4    length.set(s_v3, 10);
     1.5    length.set(v2_v4, 5);
     1.6    length.set(v2_v5, 1);
     1.7 -  length.set(v3_v5, 5);
     1.8 +  length.set(v3_v5, 4);
     1.9    length.set(v4_t, 8);
    1.10    length.set(v5_t, 8);
    1.11  
    1.12 -  ConstMap<Edge, int> const1map(1);
    1.13 +  ListGraph::EdgeMap<int> capacity(graph);
    1.14 +
    1.15 +  capacity.set(s_v1, 2);
    1.16 +  capacity.set(v1_v2, 2);
    1.17 +  capacity.set(s_v3, 1);
    1.18 +  capacity.set(v2_v4, 1);
    1.19 +  capacity.set(v2_v5, 1);
    1.20 +  capacity.set(v3_v5, 1);
    1.21 +  capacity.set(v4_t, 1);
    1.22 +  capacity.set(v5_t, 2);
    1.23 +
    1.24 +  //  ConstMap<Edge, int> const1map(1);
    1.25    std::cout << "Mincostflows algorithm test..." << std::endl;
    1.26  
    1.27 -  
    1.28 -  int k=3;
    1.29 -  MinCostFlows< ListGraph, ListGraph::EdgeMap<int>, ConstMap<Edge, int> >
    1.30 -    surb_test(graph, length, const1map);
    1.31 +  MinCostFlows< ListGraph, ListGraph::EdgeMap<int>, ListGraph::EdgeMap<int> >
    1.32 +    surb_test(graph, length, capacity);
    1.33  
    1.34 -  check(  surb_test.run(s,t,k) == 2 && surb_test.totalLength() == 46,"Two paths, total length should be 46");
    1.35 +  int k=1;
    1.36  
    1.37 -  check(surb_test.checkComplementarySlackness(), "Is the primal-dual solution pair really optimal?");
    1.38 -
    1.39 -  k=1;
    1.40    check(  surb_test.run(s,t,k) == 1 && surb_test.totalLength() == 19,"One path, total length should be 19");
    1.41  
    1.42    check(surb_test.checkComplementarySlackness(), "Is the primal-dual solution pair really optimal?");
    1.43    
    1.44 +  k=2;
    1.45 +  
    1.46 +  check(  surb_test.run(s,t,k) == 2 && surb_test.totalLength() == 41,"Two paths, total length should be 41");
    1.47 +
    1.48 +  check(surb_test.checkComplementarySlackness(), "Is the primal-dual solution pair really optimal?");
    1.49 +  
    1.50 +  
    1.51 +  k=4;
    1.52 +
    1.53 +  check(  surb_test.run(s,t,k) == 3 && surb_test.totalLength() == 64,"Three paths, total length should be 64");
    1.54 +
    1.55 +  check(surb_test.checkComplementarySlackness(), "Is the primal-dual solution pair really optimal?");
    1.56 +
    1.57  
    1.58    cout << (passed ? "All tests passed." : "Some of the tests failed!!!")
    1.59         << endl;