gravatar
kpeter (Peter Kovacs)
kpeter@inf.elte.hu
Bug fix in CostScaling (#417)
0 1 0
default
1 file changed with 2 insertions and 2 deletions:
↑ Collapse diff ↑
Ignore white space 24 line context
... ...
@@ -898,25 +898,25 @@
898 898
      _max_rank = _alpha * _res_node_num;
899 899
      _buckets.resize(_max_rank);
900 900
      _bucket_next.resize(_res_node_num + 1);
901 901
      _bucket_prev.resize(_res_node_num + 1);
902 902
      _rank.resize(_res_node_num + 1);
903 903

	
904 904
      // Execute the algorithm
905 905
      switch (method) {
906 906
        case PUSH:
907 907
          startPush();
908 908
          break;
909 909
        case AUGMENT:
910
          startAugment();
910
          startAugment(_res_node_num - 1);
911 911
          break;
912 912
        case PARTIAL_AUGMENT:
913 913
          startAugment(MAX_PATH_LENGTH);
914 914
          break;
915 915
      }
916 916

	
917 917
      // Compute node potentials for the original costs
918 918
      _arc_vec.clear();
919 919
      _cost_vec.clear();
920 920
      for (int j = 0; j != _res_arc_num; ++j) {
921 921
        if (_res_cap[j] > 0) {
922 922
          _arc_vec.push_back(IntPair(_source[j], _target[j]));
... ...
@@ -1075,25 +1075,25 @@
1075 1075

	
1076 1076
      // Relabel nodes
1077 1077
      for (int u = 0; u != _res_node_num; ++u) {
1078 1078
        int k = std::min(_rank[u], r);
1079 1079
        if (k > 0) {
1080 1080
          _pi[u] -= _epsilon * k;
1081 1081
          _next_out[u] = _first_out[u];
1082 1082
        }
1083 1083
      }
1084 1084
    }
1085 1085

	
1086 1086
    /// Execute the algorithm performing augment and relabel operations
1087
    void startAugment(int max_length = std::numeric_limits<int>::max()) {
1087
    void startAugment(int max_length) {
1088 1088
      // Paramters for heuristics
1089 1089
      const int EARLY_TERM_EPSILON_LIMIT = 1000;
1090 1090
      const double GLOBAL_UPDATE_FACTOR = 3.0;
1091 1091

	
1092 1092
      const int global_update_freq = int(GLOBAL_UPDATE_FACTOR *
1093 1093
        (_res_node_num + _sup_node_num * _sup_node_num));
1094 1094
      int next_update_limit = global_update_freq;
1095 1095

	
1096 1096
      int relabel_cnt = 0;
1097 1097

	
1098 1098
      // Perform cost scaling phases
1099 1099
      std::vector<int> path;
0 comments (0 inline)