Fix debug checking + simplify lower bound handling (#478)
authorPeter Kovacs <kpeter@inf.elte.hu>
Thu, 17 Oct 2013 09:29:37 +0200
changeset 1296330264b171cf
parent 1240 ee9bac10f58e
child 1297 c0c2f5c87aa6
Fix debug checking + simplify lower bound handling (#478)
lemon/capacity_scaling.h
lemon/cost_scaling.h
lemon/cycle_canceling.h
lemon/network_simplex.h
     1.1 --- a/lemon/capacity_scaling.h	Sat Mar 16 16:20:41 2013 +0100
     1.2 +++ b/lemon/capacity_scaling.h	Thu Oct 17 09:29:37 2013 +0200
     1.3 @@ -356,7 +356,6 @@
     1.4        _have_lower = true;
     1.5        for (ArcIt a(_graph); a != INVALID; ++a) {
     1.6          _lower[_arc_idf[a]] = map[a];
     1.7 -        _lower[_arc_idb[a]] = map[a];
     1.8        }
     1.9        return *this;
    1.10      }
    1.11 @@ -836,11 +835,11 @@
    1.12        return OPTIMAL;
    1.13      }
    1.14      
    1.15 -    // Check if the upper bound is greater or equal to the lower bound
    1.16 -    // on each arc.
    1.17 +    // Check if the upper bound is greater than or equal to the lower bound
    1.18 +    // on each forward arc.
    1.19      bool checkBoundMaps() {
    1.20        for (int j = 0; j != _res_arc_num; ++j) {
    1.21 -        if (_upper[j] < _lower[j]) return false;
    1.22 +        if (_forward[j] && _upper[j] < _lower[j]) return false;
    1.23        }
    1.24        return true;
    1.25      }
    1.26 @@ -857,7 +856,7 @@
    1.27        if (_have_lower) {
    1.28          int limit = _first_out[_root];
    1.29          for (int j = 0; j != limit; ++j) {
    1.30 -          if (!_forward[j]) _res_cap[j] += _lower[j];
    1.31 +          if (_forward[j]) _res_cap[_reverse[j]] += _lower[j];
    1.32          }
    1.33        }
    1.34  
     2.1 --- a/lemon/cost_scaling.h	Sat Mar 16 16:20:41 2013 +0100
     2.2 +++ b/lemon/cost_scaling.h	Thu Oct 17 09:29:37 2013 +0200
     2.3 @@ -370,7 +370,6 @@
     2.4        _have_lower = true;
     2.5        for (ArcIt a(_graph); a != INVALID; ++a) {
     2.6          _lower[_arc_idf[a]] = map[a];
     2.7 -        _lower[_arc_idb[a]] = map[a];
     2.8        }
     2.9        return *this;
    2.10      }
    2.11 @@ -902,11 +901,11 @@
    2.12        return OPTIMAL;
    2.13      }
    2.14      
    2.15 -    // Check if the upper bound is greater or equal to the lower bound
    2.16 -    // on each arc.
    2.17 +    // Check if the upper bound is greater than or equal to the lower bound
    2.18 +    // on each forward arc.
    2.19      bool checkBoundMaps() {
    2.20        for (int j = 0; j != _res_arc_num; ++j) {
    2.21 -        if (_upper[j] < _lower[j]) return false;
    2.22 +        if (_forward[j] && _upper[j] < _lower[j]) return false;
    2.23        }
    2.24        return true;
    2.25      }
    2.26 @@ -989,7 +988,7 @@
    2.27        if (_have_lower) {
    2.28          int limit = _first_out[_root];
    2.29          for (int j = 0; j != limit; ++j) {
    2.30 -          if (!_forward[j]) _res_cap[j] += _lower[j];
    2.31 +          if (_forward[j]) _res_cap[_reverse[j]] += _lower[j];
    2.32          }
    2.33        }
    2.34      }
     3.1 --- a/lemon/cycle_canceling.h	Sat Mar 16 16:20:41 2013 +0100
     3.2 +++ b/lemon/cycle_canceling.h	Thu Oct 17 09:29:37 2013 +0200
     3.3 @@ -281,7 +281,6 @@
     3.4        _have_lower = true;
     3.5        for (ArcIt a(_graph); a != INVALID; ++a) {
     3.6          _lower[_arc_idf[a]] = map[a];
     3.7 -        _lower[_arc_idb[a]] = map[a];
     3.8        }
     3.9        return *this;
    3.10      }
    3.11 @@ -784,11 +783,11 @@
    3.12        return OPTIMAL;
    3.13      }
    3.14      
    3.15 -    // Check if the upper bound is greater or equal to the lower bound
    3.16 -    // on each arc.
    3.17 +    // Check if the upper bound is greater than or equal to the lower bound
    3.18 +    // on each forward arc.
    3.19      bool checkBoundMaps() {
    3.20        for (int j = 0; j != _res_arc_num; ++j) {
    3.21 -        if (_upper[j] < _lower[j]) return false;
    3.22 +        if (_forward[j] && _upper[j] < _lower[j]) return false;
    3.23        }
    3.24        return true;
    3.25      }
    3.26 @@ -838,7 +837,7 @@
    3.27        if (_have_lower) {
    3.28          int limit = _first_out[_root];
    3.29          for (int j = 0; j != limit; ++j) {
    3.30 -          if (!_forward[j]) _res_cap[j] += _lower[j];
    3.31 +          if (_forward[j]) _res_cap[_reverse[j]] += _lower[j];
    3.32          }
    3.33        }
    3.34      }
     4.1 --- a/lemon/network_simplex.h	Sat Mar 16 16:20:41 2013 +0100
     4.2 +++ b/lemon/network_simplex.h	Thu Oct 17 09:29:37 2013 +0200
     4.3 @@ -1235,7 +1235,7 @@
     4.4        return true;
     4.5      }
     4.6      
     4.7 -    // Check if the upper bound is greater or equal to the lower bound
     4.8 +    // Check if the upper bound is greater than or equal to the lower bound
     4.9      // on each arc.
    4.10      bool checkBoundMaps() {
    4.11        for (int j = 0; j != _arc_num; ++j) {