COIN-OR::LEMON - Graph Library

Ticket #454: 454-ee9bac10f58e-debug-checking.patch

File 454-ee9bac10f58e-debug-checking.patch, 3.6 KB (added by Peter Kovacs, 12 years ago)
  • lemon/capacity_scaling.h

    # HG changeset patch
    # User Peter Kovacs <kpeter@inf.elte.hu>
    # Date 1363447241 -3600
    # Node ID ee9bac10f58e04dfc86f266cae4a1ad968cd8d20
    # Parent  1bafdbd2fc464a095fd0db4494bf42b0344ade84
    Debug checking for capacity bounds in min cost flow algorithms (#454)
    
    diff --git a/lemon/capacity_scaling.h b/lemon/capacity_scaling.h
    a b  
    737737      }
    738738      if (_sum_supply > 0) return INFEASIBLE;
    739739
     740      // Check lower and upper bounds
     741      LEMON_DEBUG(checkBoundMaps(),
     742          "Upper bounds must be greater or equal to the lower bounds");
     743
     744
    740745      // Initialize vectors
    741746      for (int i = 0; i != _root; ++i) {
    742747        _pi[i] = 0;
     
    830835
    831836      return OPTIMAL;
    832837    }
     838   
     839    // Check if the upper bound is greater or equal to the lower bound
     840    // on each arc.
     841    bool checkBoundMaps() {
     842      for (int j = 0; j != _res_arc_num; ++j) {
     843        if (_upper[j] < _lower[j]) return false;
     844      }
     845      return true;
     846    }
    833847
    834848    ProblemType start() {
    835849      // Execute the algorithm
  • lemon/cost_scaling.h

    diff --git a/lemon/cost_scaling.h b/lemon/cost_scaling.h
    a b  
    761761      }
    762762      if (_sum_supply > 0) return INFEASIBLE;
    763763
     764      // Check lower and upper bounds
     765      LEMON_DEBUG(checkBoundMaps(),
     766          "Upper bounds must be greater or equal to the lower bounds");
     767
    764768
    765769      // Initialize vectors
    766770      for (int i = 0; i != _res_node_num; ++i) {
     
    897901
    898902      return OPTIMAL;
    899903    }
     904   
     905    // Check if the upper bound is greater or equal to the lower bound
     906    // on each arc.
     907    bool checkBoundMaps() {
     908      for (int j = 0; j != _res_arc_num; ++j) {
     909        if (_upper[j] < _lower[j]) return false;
     910      }
     911      return true;
     912    }
    900913
    901914    // Execute the algorithm and transform the results
    902915    void start(Method method) {
  • lemon/cycle_canceling.h

    diff --git a/lemon/cycle_canceling.h b/lemon/cycle_canceling.h
    a b  
    670670      }
    671671      if (_sum_supply > 0) return INFEASIBLE;
    672672
     673      // Check lower and upper bounds
     674      LEMON_DEBUG(checkBoundMaps(),
     675          "Upper bounds must be greater or equal to the lower bounds");
     676
    673677
    674678      // Initialize vectors
    675679      for (int i = 0; i != _res_node_num; ++i) {
     
    779783
    780784      return OPTIMAL;
    781785    }
     786   
     787    // Check if the upper bound is greater or equal to the lower bound
     788    // on each arc.
     789    bool checkBoundMaps() {
     790      for (int j = 0; j != _res_arc_num; ++j) {
     791        if (_upper[j] < _lower[j]) return false;
     792      }
     793      return true;
     794    }
    782795
    783796    // Build a StaticDigraph structure containing the current
    784797    // residual network
  • lemon/network_simplex.h

    diff --git a/lemon/network_simplex.h b/lemon/network_simplex.h
    a b  
    10671067      if ( !((_stype == GEQ && _sum_supply <= 0) ||
    10681068             (_stype == LEQ && _sum_supply >= 0)) ) return false;
    10691069
     1070      // Check lower and upper bounds
     1071      LEMON_DEBUG(checkBoundMaps(),
     1072          "Upper bounds must be greater or equal to the lower bounds");
     1073
    10701074      // Remove non-zero lower bounds
    10711075      if (_have_lower) {
    10721076        for (int i = 0; i != _arc_num; ++i) {
     
    12301234
    12311235      return true;
    12321236    }
     1237   
     1238    // Check if the upper bound is greater or equal to the lower bound
     1239    // on each arc.
     1240    bool checkBoundMaps() {
     1241      for (int j = 0; j != _arc_num; ++j) {
     1242        if (_upper[j] < _lower[j]) return false;
     1243      }
     1244      return true;
     1245    }
    12331246
    12341247    // Find the join node
    12351248    void findJoinNode() {