Changeset 956:141f9c0db4a3 in lemon for test/min_cost_flow_test.cc
- Timestamp:
- 03/06/10 15:35:12 (14 years ago)
- Branch:
- default
- Children:
- 957:f802439d2b58, 959:38213abd2911, 1041:f112c18bc304
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
test/min_cost_flow_test.cc
r898 r956 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2010 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 53 53 " 11 0 0 0 0 -10 0\n" 54 54 " 12 -20 -27 0 -30 -30 -20\n" 55 "\n" 55 "\n" 56 56 "@arcs\n" 57 57 " cost cap low1 low2 low3\n" … … 103 103 "6 7 30 0 -1000\n" 104 104 "7 5 -120 0 0\n"; 105 105 106 106 char test_neg2_lgf[] = 107 107 "@nodes\n" … … 152 152 void constraints() { 153 153 checkConcept<concepts::Digraph, GR>(); 154 154 155 155 const Constraints& me = *this; 156 156 … … 181 181 typedef concepts::WriteMap<Arc, Value> FlowMap; 182 182 typedef concepts::WriteMap<Node, Cost> PotMap; 183 183 184 184 GR g; 185 185 VAM lower; … … 235 235 typename CM, typename SM, typename FM, typename PM > 236 236 bool 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, 238 238 const PM& pi, SupplyType type ) 239 239 { … … 248 248 (red_cost < 0 && flow[e] == upper[e]); 249 249 } 250 250 251 251 for (NodeIt n(gr); opt && n != INVALID; ++n) { 252 252 typename SM::Value sum = 0; … … 261 261 } 262 262 } 263 263 264 264 return opt; 265 265 } … … 286 286 } 287 287 } 288 288 289 289 for (NodeIt n(gr); n != INVALID; ++n) { 290 290 dual_cost -= red_supply[n] * pi[n]; … … 295 295 dual_cost -= (upper[a] - lower[a]) * std::max(-red_cost, 0); 296 296 } 297 297 298 298 return dual_cost == total; 299 299 } … … 333 333 { 334 334 MCF mcf1(gr), mcf2(neg1_gr), mcf3(neg2_gr); 335 335 336 336 // Basic tests 337 337 mcf1.upperMap(u).costMap(c).supplyMap(s1); … … 436 436 .node("target", w) 437 437 .run(); 438 438 439 439 std::istringstream neg_inp1(test_neg1_lgf); 440 440 DigraphReader<Digraph>(neg1_gr, neg_inp1) … … 444 444 .nodeMap("sup", neg1_s) 445 445 .run(); 446 446 447 447 std::istringstream neg_inp2(test_neg2_lgf); 448 448 DigraphReader<Digraph>(neg2_gr, neg_inp2) … … 450 450 .nodeMap("sup", neg2_s) 451 451 .run(); 452 452 453 453 // Check the interface of NetworkSimplex 454 454 { … … 502 502 503 503 // Test NetworkSimplex 504 { 504 { 505 505 typedef NetworkSimplex<Digraph> MCF; 506 506 runMcfGeqTests<MCF>(MCF::FIRST_ELIGIBLE, "NS-FE", true); … … 515 515 runMcfLeqTests<MCF>(MCF::ALTERING_LIST, "NS-AL"); 516 516 } 517 517 518 518 // Test CapacityScaling 519 519 {
Note: See TracChangeset
for help on using the changeset viewer.