COIN-OR::LEMON - Graph Library

Ignore:
Timestamp:
03/06/10 15:35:12 (14 years ago)
Author:
Alpar Juttner <alpar@…>
Branch:
default
Children:
957:f802439d2b58, 959:38213abd2911, 1041:f112c18bc304
Phase:
public
Message:

Unify the sources (#339)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/min_cost_flow_test.cc

    r898 r956  
    33 * This file is a part of LEMON, a generic C++ optimization library.
    44 *
    5  * Copyright (C) 2003-2009
     5 * Copyright (C) 2003-2010
    66 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    77 * (Egervary Research Group on Combinatorial Optimization, EGRES).
     
    5353  "   11     0    0    0    0  -10    0\n"
    5454  "   12   -20  -27    0  -30  -30  -20\n"
    55   "\n"               
     55  "\n"
    5656  "@arcs\n"
    5757  "       cost  cap low1 low2 low3\n"
     
    103103  "6 7     30      0  -1000\n"
    104104  "7 5   -120      0      0\n";
    105  
     105
    106106char test_neg2_lgf[] =
    107107  "@nodes\n"
     
    152152    void constraints() {
    153153      checkConcept<concepts::Digraph, GR>();
    154      
     154
    155155      const Constraints& me = *this;
    156156
     
    181181    typedef concepts::WriteMap<Arc, Value> FlowMap;
    182182    typedef concepts::WriteMap<Node, Cost> PotMap;
    183  
     183
    184184    GR g;
    185185    VAM lower;
     
    235235           typename CM, typename SM, typename FM, typename PM >
    236236bool checkPotential( const GR& gr, const LM& lower, const UM& upper,
    237                      const CM& cost, const SM& supply, const FM& flow, 
     237                     const CM& cost, const SM& supply, const FM& flow,
    238238                     const PM& pi, SupplyType type )
    239239{
     
    248248          (red_cost < 0 && flow[e] == upper[e]);
    249249  }
    250  
     250
    251251  for (NodeIt n(gr); opt && n != INVALID; ++n) {
    252252    typename SM::Value sum = 0;
     
    261261    }
    262262  }
    263  
     263
    264264  return opt;
    265265}
     
    286286    }
    287287  }
    288  
     288
    289289  for (NodeIt n(gr); n != INVALID; ++n) {
    290290    dual_cost -= red_supply[n] * pi[n];
     
    295295    dual_cost -= (upper[a] - lower[a]) * std::max(-red_cost, 0);
    296296  }
    297  
     297
    298298  return dual_cost == total;
    299299}
     
    333333{
    334334  MCF mcf1(gr), mcf2(neg1_gr), mcf3(neg2_gr);
    335  
     335
    336336  // Basic tests
    337337  mcf1.upperMap(u).costMap(c).supplyMap(s1);
     
    436436    .node("target", w)
    437437    .run();
    438  
     438
    439439  std::istringstream neg_inp1(test_neg1_lgf);
    440440  DigraphReader<Digraph>(neg1_gr, neg_inp1)
     
    444444    .nodeMap("sup", neg1_s)
    445445    .run();
    446  
     446
    447447  std::istringstream neg_inp2(test_neg2_lgf);
    448448  DigraphReader<Digraph>(neg2_gr, neg_inp2)
     
    450450    .nodeMap("sup", neg2_s)
    451451    .run();
    452  
     452
    453453  // Check the interface of NetworkSimplex
    454454  {
     
    502502
    503503  // Test NetworkSimplex
    504   { 
     504  {
    505505    typedef NetworkSimplex<Digraph> MCF;
    506506    runMcfGeqTests<MCF>(MCF::FIRST_ELIGIBLE, "NS-FE", true);
     
    515515    runMcfLeqTests<MCF>(MCF::ALTERING_LIST,  "NS-AL");
    516516  }
    517  
     517
    518518  // Test CapacityScaling
    519519  {
Note: See TracChangeset for help on using the changeset viewer.