lemon/capacity_scaling.h
changeset 1111 a78e5b779b69
parent 1092 dceba191c00d
parent 1110 c0c2f5c87aa6
child 1155 a7d841273c68
     1.1 --- a/lemon/capacity_scaling.h	Wed Sep 25 11:15:56 2013 +0200
     1.2 +++ b/lemon/capacity_scaling.h	Thu Oct 17 15:08:41 2013 +0200
     1.3 @@ -163,7 +163,7 @@
     1.4      int _root;
     1.5  
     1.6      // Parameters of the problem
     1.7 -    bool _have_lower;
     1.8 +    bool _has_lower;
     1.9      Value _sum_supply;
    1.10  
    1.11      // Data structures for storing the digraph
    1.12 @@ -356,10 +356,9 @@
    1.13      /// \return <tt>(*this)</tt>
    1.14      template <typename LowerMap>
    1.15      CapacityScaling& lowerMap(const LowerMap& map) {
    1.16 -      _have_lower = true;
    1.17 +      _has_lower = true;
    1.18        for (ArcIt a(_graph); a != INVALID; ++a) {
    1.19          _lower[_arc_idf[a]] = map[a];
    1.20 -        _lower[_arc_idb[a]] = map[a];
    1.21        }
    1.22        return *this;
    1.23      }
    1.24 @@ -543,7 +542,7 @@
    1.25          _upper[j] = INF;
    1.26          _cost[j] = _forward[j] ? 1 : -1;
    1.27        }
    1.28 -      _have_lower = false;
    1.29 +      _has_lower = false;
    1.30        return *this;
    1.31      }
    1.32  
    1.33 @@ -754,7 +753,7 @@
    1.34        // Remove non-zero lower bounds
    1.35        const Value MAX = std::numeric_limits<Value>::max();
    1.36        int last_out;
    1.37 -      if (_have_lower) {
    1.38 +      if (_has_lower) {
    1.39          for (int i = 0; i != _root; ++i) {
    1.40            last_out = _first_out[i+1];
    1.41            for (int j = _first_out[i]; j != last_out; ++j) {
    1.42 @@ -839,11 +838,11 @@
    1.43        return OPTIMAL;
    1.44      }
    1.45  
    1.46 -    // Check if the upper bound is greater or equal to the lower bound
    1.47 -    // on each arc.
    1.48 +    // Check if the upper bound is greater than or equal to the lower bound
    1.49 +    // on each forward arc.
    1.50      bool checkBoundMaps() {
    1.51        for (int j = 0; j != _res_arc_num; ++j) {
    1.52 -        if (_upper[j] < _lower[j]) return false;
    1.53 +        if (_forward[j] && _upper[j] < _lower[j]) return false;
    1.54        }
    1.55        return true;
    1.56      }
    1.57 @@ -857,10 +856,10 @@
    1.58          pt = startWithoutScaling();
    1.59  
    1.60        // Handle non-zero lower bounds
    1.61 -      if (_have_lower) {
    1.62 +      if (_has_lower) {
    1.63          int limit = _first_out[_root];
    1.64          for (int j = 0; j != limit; ++j) {
    1.65 -          if (!_forward[j]) _res_cap[j] += _lower[j];
    1.66 +          if (_forward[j]) _res_cap[_reverse[j]] += _lower[j];
    1.67          }
    1.68        }
    1.69