lemon/cost_scaling.h
changeset 1240 ee9bac10f58e
parent 1165 16f55008c863
child 1241 879fcb781086
child 1296 330264b171cf
equal deleted inserted replaced
25:ec27f2e73ddc 28:fbe19ca098b9
   759       for (int i = 0; i != _root; ++i) {
   759       for (int i = 0; i != _root; ++i) {
   760         _sum_supply += _supply[i];
   760         _sum_supply += _supply[i];
   761       }
   761       }
   762       if (_sum_supply > 0) return INFEASIBLE;
   762       if (_sum_supply > 0) return INFEASIBLE;
   763 
   763 
       
   764       // Check lower and upper bounds
       
   765       LEMON_DEBUG(checkBoundMaps(),
       
   766           "Upper bounds must be greater or equal to the lower bounds");
       
   767 
   764 
   768 
   765       // Initialize vectors
   769       // Initialize vectors
   766       for (int i = 0; i != _res_node_num; ++i) {
   770       for (int i = 0; i != _res_node_num; ++i) {
   767         _pi[i] = 0;
   771         _pi[i] = 0;
   768         _excess[i] = _supply[i];
   772         _excess[i] = _supply[i];
   894       _bucket_next.resize(_res_node_num + 1);
   898       _bucket_next.resize(_res_node_num + 1);
   895       _bucket_prev.resize(_res_node_num + 1);
   899       _bucket_prev.resize(_res_node_num + 1);
   896       _rank.resize(_res_node_num + 1);
   900       _rank.resize(_res_node_num + 1);
   897 
   901 
   898       return OPTIMAL;
   902       return OPTIMAL;
       
   903     }
       
   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;
   899     }
   912     }
   900 
   913 
   901     // Execute the algorithm and transform the results
   914     // Execute the algorithm and transform the results
   902     void start(Method method) {
   915     void start(Method method) {
   903       const int MAX_PARTIAL_PATH_LENGTH = 4;
   916       const int MAX_PARTIAL_PATH_LENGTH = 4;