diff -r 15e233f588da -r a78e5b779b69 lemon/capacity_scaling.h --- a/lemon/capacity_scaling.h Wed Sep 25 11:15:56 2013 +0200 +++ b/lemon/capacity_scaling.h Thu Oct 17 15:08:41 2013 +0200 @@ -163,7 +163,7 @@ int _root; // Parameters of the problem - bool _have_lower; + bool _has_lower; Value _sum_supply; // Data structures for storing the digraph @@ -356,10 +356,9 @@ /// \return (*this) template CapacityScaling& 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; } @@ -543,7 +542,7 @@ _upper[j] = INF; _cost[j] = _forward[j] ? 1 : -1; } - _have_lower = false; + _has_lower = false; return *this; } @@ -754,7 +753,7 @@ // Remove non-zero lower bounds 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) { @@ -839,11 +838,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; } @@ -857,10 +856,10 @@ pt = startWithoutScaling(); // 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]; } }