diff -r 15e233f588da -r a78e5b779b69 lemon/cycle_canceling.h --- a/lemon/cycle_canceling.h Wed Sep 25 11:15:56 2013 +0200 +++ b/lemon/cycle_canceling.h Thu Oct 17 15:08:41 2013 +0200 @@ -195,7 +195,7 @@ int _root; // Parameters of the problem - bool _have_lower; + bool _has_lower; Value _sum_supply; // Data structures for storing the digraph @@ -278,10 +278,9 @@ /// \return (*this) template CycleCanceling& lowerMap(const LowerMap& map) { - _have_lower = true; + _has_lower = true; for (ArcIt a(_graph); a != INVALID; ++a) { _lower[_arc_idf[a]] = map[a]; - _lower[_arc_idb[a]] = map[a]; } return *this; } @@ -471,7 +470,7 @@ _cost[j] = 0; _cost[_reverse[j]] = 0; } - _have_lower = false; + _has_lower = false; return *this; } @@ -684,7 +683,7 @@ // Remove infinite upper bounds and check negative arcs const Value MAX = std::numeric_limits::max(); int last_out; - if (_have_lower) { + if (_has_lower) { for (int i = 0; i != _root; ++i) { last_out = _first_out[i+1]; for (int j = _first_out[i]; j != last_out; ++j) { @@ -727,7 +726,7 @@ for (NodeIt n(_graph); n != INVALID; ++n) { sup[n] = _supply[_node_id[n]]; } - if (_have_lower) { + if (_has_lower) { for (ArcIt a(_graph); a != INVALID; ++a) { int j = _arc_idf[a]; Value c = _lower[j]; @@ -784,11 +783,11 @@ return OPTIMAL; } - // Check if the upper bound is greater or equal to the lower bound - // on each arc. + // Check if the upper bound is greater than or equal to the lower bound + // on each forward arc. bool checkBoundMaps() { for (int j = 0; j != _res_arc_num; ++j) { - if (_upper[j] < _lower[j]) return false; + if (_forward[j] && _upper[j] < _lower[j]) return false; } return true; } @@ -835,10 +834,10 @@ } // Handle non-zero lower bounds - if (_have_lower) { + if (_has_lower) { int limit = _first_out[_root]; for (int j = 0; j != limit; ++j) { - if (!_forward[j]) _res_cap[j] += _lower[j]; + if (_forward[j]) _res_cap[_reverse[j]] += _lower[j]; } } }