test/min_cost_flow_test.cc
changeset 653 c7d160f73d52
parent 652 5232721b3f14
child 654 9ad8d2122b50
     1.1 --- a/test/min_cost_flow_test.cc	Wed Mar 25 15:58:44 2009 +0100
     1.2 +++ b/test/min_cost_flow_test.cc	Wed Mar 25 21:37:50 2009 +0100
     1.3 @@ -89,7 +89,8 @@
     1.4  
     1.5        MCF mcf(g);
     1.6  
     1.7 -      b = mcf.lowerMap(lower)
     1.8 +      b = mcf.reset()
     1.9 +             .lowerMap(lower)
    1.10               .upperMap(upper)
    1.11               .capacityMap(upper)
    1.12               .boundMaps(lower, upper)
    1.13 @@ -242,46 +243,44 @@
    1.14  
    1.15    // A. Test NetworkSimplex with the default pivot rule
    1.16    {
    1.17 -    NetworkSimplex<Digraph> mcf1(gr), mcf2(gr), mcf3(gr), mcf4(gr),
    1.18 -                            mcf5(gr), mcf6(gr), mcf7(gr), mcf8(gr);
    1.19 +    NetworkSimplex<Digraph> mcf(gr);
    1.20  
    1.21 -    checkMcf(mcf1, mcf1.upperMap(u).costMap(c).supplyMap(s1).run(),
    1.22 +    mcf.upperMap(u).costMap(c);
    1.23 +    checkMcf(mcf, mcf.supplyMap(s1).run(),
    1.24               gr, l1, u, c, s1, true,  5240, "#A1");
    1.25 -    checkMcf(mcf2, mcf2.upperMap(u).costMap(c).stSupply(v, w, 27).run(),
    1.26 +    checkMcf(mcf, mcf.stSupply(v, w, 27).run(),
    1.27               gr, l1, u, c, s2, true,  7620, "#A2");
    1.28 -    checkMcf(mcf3, mcf3.boundMaps(l2, u).costMap(c).supplyMap(s1).run(),
    1.29 +    mcf.lowerMap(l2);
    1.30 +    checkMcf(mcf, mcf.supplyMap(s1).run(),
    1.31               gr, l2, u, c, s1, true,  5970, "#A3");
    1.32 -    checkMcf(mcf4, mcf4.boundMaps(l2, u).costMap(c).stSupply(v, w, 27).run(),
    1.33 +    checkMcf(mcf, mcf.stSupply(v, w, 27).run(),
    1.34               gr, l2, u, c, s2, true,  8010, "#A4");
    1.35 -    checkMcf(mcf5, mcf5.supplyMap(s1).run(),
    1.36 +    mcf.reset();
    1.37 +    checkMcf(mcf, mcf.supplyMap(s1).run(),
    1.38               gr, l1, cu, cc, s1, true,  74, "#A5");
    1.39 -    checkMcf(mcf6, mcf6.stSupply(v, w, 27).lowerMap(l2).run(),
    1.40 +    checkMcf(mcf, mcf.lowerMap(l2).stSupply(v, w, 27).run(),
    1.41               gr, l2, cu, cc, s2, true,  94, "#A6");
    1.42 -    checkMcf(mcf7, mcf7.run(),
    1.43 +    mcf.reset();
    1.44 +    checkMcf(mcf, mcf.run(),
    1.45               gr, l1, cu, cc, s3, true,   0, "#A7");
    1.46 -    checkMcf(mcf8, mcf8.boundMaps(l2, u).run(),
    1.47 +    checkMcf(mcf, mcf.boundMaps(l2, u).run(),
    1.48               gr, l2, u, cc, s3, false,   0, "#A8");
    1.49    }
    1.50  
    1.51    // B. Test NetworkSimplex with each pivot rule
    1.52    {
    1.53 -    NetworkSimplex<Digraph> mcf1(gr), mcf2(gr), mcf3(gr), mcf4(gr), mcf5(gr);
    1.54 -    NetworkSimplex<Digraph>::PivotRule pr;
    1.55 +    NetworkSimplex<Digraph> mcf(gr);
    1.56 +    mcf.supplyMap(s1).costMap(c).capacityMap(u).lowerMap(l2);
    1.57  
    1.58 -    pr = NetworkSimplex<Digraph>::FIRST_ELIGIBLE;
    1.59 -    checkMcf(mcf1, mcf1.boundMaps(l2, u).costMap(c).supplyMap(s1).run(pr),
    1.60 +    checkMcf(mcf, mcf.run(NetworkSimplex<Digraph>::FIRST_ELIGIBLE),
    1.61               gr, l2, u, c, s1, true,  5970, "#B1");
    1.62 -    pr = NetworkSimplex<Digraph>::BEST_ELIGIBLE;
    1.63 -    checkMcf(mcf2, mcf2.boundMaps(l2, u).costMap(c).supplyMap(s1).run(pr),
    1.64 +    checkMcf(mcf, mcf.run(NetworkSimplex<Digraph>::BEST_ELIGIBLE),
    1.65               gr, l2, u, c, s1, true,  5970, "#B2");
    1.66 -    pr = NetworkSimplex<Digraph>::BLOCK_SEARCH;
    1.67 -    checkMcf(mcf3, mcf3.boundMaps(l2, u).costMap(c).supplyMap(s1).run(pr),
    1.68 +    checkMcf(mcf, mcf.run(NetworkSimplex<Digraph>::BLOCK_SEARCH),
    1.69               gr, l2, u, c, s1, true,  5970, "#B3");
    1.70 -    pr = NetworkSimplex<Digraph>::CANDIDATE_LIST;
    1.71 -    checkMcf(mcf4, mcf4.boundMaps(l2, u).costMap(c).supplyMap(s1).run(pr),
    1.72 +    checkMcf(mcf, mcf.run(NetworkSimplex<Digraph>::CANDIDATE_LIST),
    1.73               gr, l2, u, c, s1, true,  5970, "#B4");
    1.74 -    pr = NetworkSimplex<Digraph>::ALTERING_LIST;
    1.75 -    checkMcf(mcf5, mcf5.boundMaps(l2, u).costMap(c).supplyMap(s1).run(pr),
    1.76 +    checkMcf(mcf, mcf.run(NetworkSimplex<Digraph>::ALTERING_LIST),
    1.77               gr, l2, u, c, s1, true,  5970, "#B5");
    1.78    }
    1.79