test/min_cost_flow_test.cc
changeset 914 aa8c9008b3de
parent 885 d93490b861e9
child 956 141f9c0db4a3
equal deleted inserted replaced
11:3048b7fb1ec9 12:a6427e0fd5f6
   155       const Constraints& me = *this;
   155       const Constraints& me = *this;
   156 
   156 
   157       MCF mcf(me.g);
   157       MCF mcf(me.g);
   158       const MCF& const_mcf = mcf;
   158       const MCF& const_mcf = mcf;
   159 
   159 
   160       b = mcf.reset()
   160       b = mcf.reset().resetParams()
   161              .lowerMap(me.lower)
   161              .lowerMap(me.lower)
   162              .upperMap(me.upper)
   162              .upperMap(me.upper)
   163              .costMap(me.cost)
   163              .costMap(me.cost)
   164              .supplyMap(me.sup)
   164              .supplyMap(me.sup)
   165              .stSupply(me.n, me.n, me.k)
   165              .stSupply(me.n, me.n, me.k)
   344   checkMcf(mcf1, mcf1.run(param), gr, l2, u, c, s1,
   344   checkMcf(mcf1, mcf1.run(param), gr, l2, u, c, s1,
   345            mcf1.OPTIMAL, true,     5970, test_str + "-3");
   345            mcf1.OPTIMAL, true,     5970, test_str + "-3");
   346   mcf1.stSupply(v, w, 27);
   346   mcf1.stSupply(v, w, 27);
   347   checkMcf(mcf1, mcf1.run(param), gr, l2, u, c, s2,
   347   checkMcf(mcf1, mcf1.run(param), gr, l2, u, c, s2,
   348            mcf1.OPTIMAL, true,     8010, test_str + "-4");
   348            mcf1.OPTIMAL, true,     8010, test_str + "-4");
   349   mcf1.reset().supplyMap(s1);
   349   mcf1.resetParams().supplyMap(s1);
   350   checkMcf(mcf1, mcf1.run(param), gr, l1, cu, cc, s1,
   350   checkMcf(mcf1, mcf1.run(param), gr, l1, cu, cc, s1,
   351            mcf1.OPTIMAL, true,       74, test_str + "-5");
   351            mcf1.OPTIMAL, true,       74, test_str + "-5");
   352   mcf1.lowerMap(l2).stSupply(v, w, 27);
   352   mcf1.lowerMap(l2).stSupply(v, w, 27);
   353   checkMcf(mcf1, mcf1.run(param), gr, l2, cu, cc, s2,
   353   checkMcf(mcf1, mcf1.run(param), gr, l2, cu, cc, s2,
   354            mcf1.OPTIMAL, true,       94, test_str + "-6");
   354            mcf1.OPTIMAL, true,       94, test_str + "-6");
   361   mcf1.lowerMap(l3).upperMap(u).costMap(c).supplyMap(s4);
   361   mcf1.lowerMap(l3).upperMap(u).costMap(c).supplyMap(s4);
   362   checkMcf(mcf1, mcf1.run(param), gr, l3, u, c, s4,
   362   checkMcf(mcf1, mcf1.run(param), gr, l3, u, c, s4,
   363            mcf1.OPTIMAL, true,     6360, test_str + "-9");
   363            mcf1.OPTIMAL, true,     6360, test_str + "-9");
   364 
   364 
   365   // Tests for the GEQ form
   365   // Tests for the GEQ form
   366   mcf1.reset().upperMap(u).costMap(c).supplyMap(s5);
   366   mcf1.resetParams().upperMap(u).costMap(c).supplyMap(s5);
   367   checkMcf(mcf1, mcf1.run(param), gr, l1, u, c, s5,
   367   checkMcf(mcf1, mcf1.run(param), gr, l1, u, c, s5,
   368            mcf1.OPTIMAL, true,     3530, test_str + "-10", GEQ);
   368            mcf1.OPTIMAL, true,     3530, test_str + "-10", GEQ);
   369   mcf1.lowerMap(l2);
   369   mcf1.lowerMap(l2);
   370   checkMcf(mcf1, mcf1.run(param), gr, l2, u, c, s5,
   370   checkMcf(mcf1, mcf1.run(param), gr, l2, u, c, s5,
   371            mcf1.OPTIMAL, true,     4540, test_str + "-11", GEQ);
   371            mcf1.OPTIMAL, true,     4540, test_str + "-11", GEQ);
   378   checkMcf(mcf2, mcf2.run(param), neg1_gr, neg1_l1, neg1_u1, neg1_c, neg1_s,
   378   checkMcf(mcf2, mcf2.run(param), neg1_gr, neg1_l1, neg1_u1, neg1_c, neg1_s,
   379            mcf2.UNBOUNDED, false,     0, test_str + "-13");
   379            mcf2.UNBOUNDED, false,     0, test_str + "-13");
   380   mcf2.upperMap(neg1_u2);
   380   mcf2.upperMap(neg1_u2);
   381   checkMcf(mcf2, mcf2.run(param), neg1_gr, neg1_l1, neg1_u2, neg1_c, neg1_s,
   381   checkMcf(mcf2, mcf2.run(param), neg1_gr, neg1_l1, neg1_u2, neg1_c, neg1_s,
   382            mcf2.OPTIMAL, true,   -40000, test_str + "-14");
   382            mcf2.OPTIMAL, true,   -40000, test_str + "-14");
   383   mcf2.reset().lowerMap(neg1_l2).costMap(neg1_c).supplyMap(neg1_s);
   383   mcf2.resetParams().lowerMap(neg1_l2).costMap(neg1_c).supplyMap(neg1_s);
   384   checkMcf(mcf2, mcf2.run(param), neg1_gr, neg1_l2, neg1_u1, neg1_c, neg1_s,
   384   checkMcf(mcf2, mcf2.run(param), neg1_gr, neg1_l2, neg1_u1, neg1_c, neg1_s,
   385            mcf2.UNBOUNDED, false,     0, test_str + "-15");
   385            mcf2.UNBOUNDED, false,     0, test_str + "-15");
   386 
   386 
   387   mcf3.costMap(neg2_c).supplyMap(neg2_s);
   387   mcf3.costMap(neg2_c).supplyMap(neg2_s);
   388   if (full_neg_cost_support) {
   388   if (full_neg_cost_support) {