# HG changeset patch # User Peter Kovacs # Date 1381994977 -7200 # Node ID 330264b171cf7ed09fb3117033abddc4d3ebf74d # Parent ee9bac10f58e04dfc86f266cae4a1ad968cd8d20 Fix debug checking + simplify lower bound handling (#478) diff -r ee9bac10f58e -r 330264b171cf lemon/capacity_scaling.h --- a/lemon/capacity_scaling.h Sat Mar 16 16:20:41 2013 +0100 +++ b/lemon/capacity_scaling.h Thu Oct 17 09:29:37 2013 +0200 @@ -356,7 +356,6 @@ _have_lower = true; for (ArcIt a(_graph); a != INVALID; ++a) { _lower[_arc_idf[a]] = map[a]; - _lower[_arc_idb[a]] = map[a]; } return *this; } @@ -836,11 +835,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,7 +856,7 @@ if (_have_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]; } } diff -r ee9bac10f58e -r 330264b171cf lemon/cost_scaling.h --- a/lemon/cost_scaling.h Sat Mar 16 16:20:41 2013 +0100 +++ b/lemon/cost_scaling.h Thu Oct 17 09:29:37 2013 +0200 @@ -370,7 +370,6 @@ _have_lower = true; for (ArcIt a(_graph); a != INVALID; ++a) { _lower[_arc_idf[a]] = map[a]; - _lower[_arc_idb[a]] = map[a]; } return *this; } @@ -902,11 +901,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; } @@ -989,7 +988,7 @@ if (_have_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]; } } } diff -r ee9bac10f58e -r 330264b171cf lemon/cycle_canceling.h --- a/lemon/cycle_canceling.h Sat Mar 16 16:20:41 2013 +0100 +++ b/lemon/cycle_canceling.h Thu Oct 17 09:29:37 2013 +0200 @@ -281,7 +281,6 @@ _have_lower = true; for (ArcIt a(_graph); a != INVALID; ++a) { _lower[_arc_idf[a]] = map[a]; - _lower[_arc_idb[a]] = map[a]; } return *this; } @@ -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; } @@ -838,7 +837,7 @@ if (_have_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]; } } } diff -r ee9bac10f58e -r 330264b171cf lemon/network_simplex.h --- a/lemon/network_simplex.h Sat Mar 16 16:20:41 2013 +0100 +++ b/lemon/network_simplex.h Thu Oct 17 09:29:37 2013 +0200 @@ -1235,7 +1235,7 @@ return true; } - // Check if the upper bound is greater or equal to the lower bound + // Check if the upper bound is greater than or equal to the lower bound // on each arc. bool checkBoundMaps() { for (int j = 0; j != _arc_num; ++j) {