# HG changeset patch
# User Peter Kovacs <kpeter@inf.elte.hu>
# Date 1240656142 -7200
# Node ID c20b7ed31aad9cd7b491423034cde965044b9986
# Parent 547e6b876ee16dec1a965c114282dc5be05e75ba
Bug fix + improvements in Circulation (#266)
- Bug fix in upperMap().
- Add LEMON_DEBUG checks for lower<=upper.
diff --git a/lemon/circulation.h b/lemon/circulation.h
a
|
b
|
|
151 | 151 | the direction of the arcs and taking the negative of the supply values |
152 | 152 | (e.g. using \ref ReverseDigraph and \ref NegMap adaptors). |
153 | 153 | |
| 154 | This algorithm either calculates a feasible circulation, or provides |
| 155 | a \ref barrier() "barrier", which prooves that a feasible soultion |
| 156 | cannot exist. |
| 157 | |
154 | 158 | Note that this algorithm also provides a feasible solution for the |
155 | 159 | \ref min_cost_flow "minimum cost flow problem". |
156 | 160 | |
… |
… |
|
337 | 341 | |
338 | 342 | private: |
339 | 343 | |
| 344 | bool checkBoundMaps() { |
| 345 | for (ArcIt e(_g);e!=INVALID;++e) { |
| 346 | if (_tol.less((*_up)[e], (*_lo)[e])) return false; |
| 347 | } |
| 348 | return true; |
| 349 | } |
| 350 | |
340 | 351 | void createStructures() { |
341 | 352 | _node_num = _el = countNodes(_g); |
342 | 353 | |
… |
… |
|
380 | 391 | |
381 | 392 | /// Sets the upper bound (capacity) map. |
382 | 393 | /// \return <tt>(*this)</tt> |
383 | | Circulation& upperMap(const LowerMap& map) { |
| 394 | Circulation& upperMap(const UpperMap& map) { |
384 | 395 | _up = ↦ |
385 | 396 | return *this; |
386 | 397 | } |
… |
… |
|
467 | 478 | /// to the lower bound. |
468 | 479 | void init() |
469 | 480 | { |
| 481 | LEMON_DEBUG(checkBoundMaps(), |
| 482 | "Upper bounds must be greater or equal to the lower bounds"); |
| 483 | |
470 | 484 | createStructures(); |
471 | 485 | |
472 | 486 | for(NodeIt n(_g);n!=INVALID;++n) { |
… |
… |
|
496 | 510 | /// to construct the initial solution. |
497 | 511 | void greedyInit() |
498 | 512 | { |
| 513 | LEMON_DEBUG(checkBoundMaps(), |
| 514 | "Upper bounds must be greater or equal to the lower bounds"); |
| 515 | |
499 | 516 | createStructures(); |
500 | 517 | |
501 | 518 | for(NodeIt n(_g);n!=INVALID;++n) { |