# HG changeset patch # User Alpar Juttner # Date 1375190685 -7200 # Node ID 879fcb781086c50dc6bb528f28ce99a7bfe17bdc # Parent d1a48668ddb470a23a2ae6e38765a81209e48b9e# Parent ee9bac10f58e04dfc86f266cae4a1ad968cd8d20 Merge #454 diff -r d1a48668ddb4 -r 879fcb781086 lemon/capacity_scaling.h --- a/lemon/capacity_scaling.h Tue Jul 30 15:14:29 2013 +0200 +++ b/lemon/capacity_scaling.h Tue Jul 30 15:24:45 2013 +0200 @@ -739,6 +739,11 @@ } if (_sum_supply > 0) return INFEASIBLE; + // Check lower and upper bounds + LEMON_DEBUG(checkBoundMaps(), + "Upper bounds must be greater or equal to the lower bounds"); + + // Initialize vectors for (int i = 0; i != _root; ++i) { _pi[i] = 0; @@ -832,6 +837,15 @@ return OPTIMAL; } + + // Check if the upper bound is greater or equal to the lower bound + // on each arc. + bool checkBoundMaps() { + for (int j = 0; j != _res_arc_num; ++j) { + if (_upper[j] < _lower[j]) return false; + } + return true; + } ProblemType start() { // Execute the algorithm diff -r d1a48668ddb4 -r 879fcb781086 lemon/cost_scaling.h --- a/lemon/cost_scaling.h Tue Jul 30 15:14:29 2013 +0200 +++ b/lemon/cost_scaling.h Tue Jul 30 15:24:45 2013 +0200 @@ -763,6 +763,10 @@ } if (_sum_supply > 0) return INFEASIBLE; + // Check lower and upper bounds + LEMON_DEBUG(checkBoundMaps(), + "Upper bounds must be greater or equal to the lower bounds"); + // Initialize vectors for (int i = 0; i != _res_node_num; ++i) { @@ -899,6 +903,15 @@ return OPTIMAL; } + + // Check if the upper bound is greater or equal to the lower bound + // on each arc. + bool checkBoundMaps() { + for (int j = 0; j != _res_arc_num; ++j) { + if (_upper[j] < _lower[j]) return false; + } + return true; + } // Execute the algorithm and transform the results void start(Method method) { diff -r d1a48668ddb4 -r 879fcb781086 lemon/cycle_canceling.h --- a/lemon/cycle_canceling.h Tue Jul 30 15:14:29 2013 +0200 +++ b/lemon/cycle_canceling.h Tue Jul 30 15:24:45 2013 +0200 @@ -670,6 +670,10 @@ } if (_sum_supply > 0) return INFEASIBLE; + // Check lower and upper bounds + LEMON_DEBUG(checkBoundMaps(), + "Upper bounds must be greater or equal to the lower bounds"); + // Initialize vectors for (int i = 0; i != _res_node_num; ++i) { @@ -779,6 +783,15 @@ return OPTIMAL; } + + // Check if the upper bound is greater or equal to the lower bound + // on each arc. + bool checkBoundMaps() { + for (int j = 0; j != _res_arc_num; ++j) { + if (_upper[j] < _lower[j]) return false; + } + return true; + } // Build a StaticDigraph structure containing the current // residual network diff -r d1a48668ddb4 -r 879fcb781086 lemon/network_simplex.h --- a/lemon/network_simplex.h Tue Jul 30 15:14:29 2013 +0200 +++ b/lemon/network_simplex.h Tue Jul 30 15:24:45 2013 +0200 @@ -1067,6 +1067,10 @@ if ( !((_stype == GEQ && _sum_supply <= 0) || (_stype == LEQ && _sum_supply >= 0)) ) return false; + // Check lower and upper bounds + LEMON_DEBUG(checkBoundMaps(), + "Upper bounds must be greater or equal to the lower bounds"); + // Remove non-zero lower bounds if (_have_lower) { for (int i = 0; i != _arc_num; ++i) { @@ -1230,6 +1234,15 @@ return true; } + + // Check if the upper bound is greater or equal to the lower bound + // on each arc. + bool checkBoundMaps() { + for (int j = 0; j != _arc_num; ++j) { + if (_upper[j] < _lower[j]) return false; + } + return true; + } // Find the join node void findJoinNode() {