gravatar
deba@inf.elte.hu
deba@inf.elte.hu
Fix in HaoOrlin (#264)
0 2 0
default
2 files changed with 14 insertions and 24 deletions:
↑ Collapse diff ↑
Ignore white space 24 line context
... ...
@@ -217,24 +217,25 @@
217 217
      } else {
218 218
        (*_prev)[i] = INVALID;
219 219
        _first[bucket] = i;
220 220
        (*_next)[i] = INVALID;
221 221
        _last[bucket] = i;
222 222
      }
223 223
    }
224 224

	
225 225
    void findMinCutOut() {
226 226

	
227 227
      for (NodeIt n(_graph); n != INVALID; ++n) {
228 228
        (*_excess)[n] = 0;
229
        (*_source_set)[n] = false;
229 230
      }
230 231

	
231 232
      for (ArcIt a(_graph); a != INVALID; ++a) {
232 233
        (*_flow)[a] = 0;
233 234
      }
234 235

	
235 236
      int bucket_num = 0;
236 237
      std::vector<Node> queue(_node_num);
237 238
      int qfirst = 0, qlast = 0, qsep = 0;
238 239

	
239 240
      {
240 241
        typename Digraph::template NodeMap<bool> reached(_graph, false);
... ...
@@ -516,24 +517,25 @@
516 517
          while (_highest != _sets.back().end() &&
517 518
                 !(*_active)[_first[*_highest]]) {
518 519
            ++_highest;
519 520
          }
520 521
        }
521 522
      }
522 523
    }
523 524

	
524 525
    void findMinCutIn() {
525 526

	
526 527
      for (NodeIt n(_graph); n != INVALID; ++n) {
527 528
        (*_excess)[n] = 0;
529
        (*_source_set)[n] = false;
528 530
      }
529 531

	
530 532
      for (ArcIt a(_graph); a != INVALID; ++a) {
531 533
        (*_flow)[a] = 0;
532 534
      }
533 535

	
534 536
      int bucket_num = 0;
535 537
      std::vector<Node> queue(_node_num);
536 538
      int qfirst = 0, qlast = 0, qsep = 0;
537 539

	
538 540
      {
539 541
        typename Digraph::template NodeMap<bool> reached(_graph, false);
Ignore white space 24 line context
... ...
@@ -102,74 +102,62 @@
102 102
  istringstream input(lgf);
103 103
  digraphReader(graph, input)
104 104
    .arcMap("cap1", cap1)
105 105
    .arcMap("cap2", cap2)
106 106
    .arcMap("cap3", cap3)
107 107
    .run();
108 108

	
109 109
  {
110 110
    HaoOrlin<SmartDigraph> ho(graph, cap1);
111 111
    ho.run();
112 112
    ho.minCutMap(cut);
113 113
    
114
    // BUG: The cut value should be positive
115
    check(ho.minCutValue() == 0, "Wrong cut value");
116
    // BUG: It should work
117
    //check(ho.minCutValue() == cutValue(graph, cap1, cut), "Wrong cut value");
114
    check(ho.minCutValue() == 1, "Wrong cut value");
115
    check(ho.minCutValue() == cutValue(graph, cap1, cut), "Wrong cut value");
118 116
  }
119 117
  {
120 118
    HaoOrlin<SmartDigraph> ho(graph, cap2);
121 119
    ho.run();
122 120
    ho.minCutMap(cut);
123
    
124
    // BUG: The cut value should be positive
125
    check(ho.minCutValue() == 0, "Wrong cut value");
126
    // BUG: It should work
127
    //check(ho.minCutValue() == cutValue(graph, cap2, cut), "Wrong cut value");
121

	
122
    check(ho.minCutValue() == 1, "Wrong cut value");
123
    check(ho.minCutValue() == cutValue(graph, cap2, cut), "Wrong cut value");
128 124
  }
129 125
  {
130 126
    HaoOrlin<SmartDigraph> ho(graph, cap3);
131 127
    ho.run();
132 128
    ho.minCutMap(cut);
133 129
    
134
    // BUG: The cut value should be positive
135
    check(ho.minCutValue() == 0, "Wrong cut value");
136
    // BUG: It should work
137
    //check(ho.minCutValue() == cutValue(graph, cap3, cut), "Wrong cut value");
130
    check(ho.minCutValue() == 1, "Wrong cut value");
131
    check(ho.minCutValue() == cutValue(graph, cap3, cut), "Wrong cut value");
138 132
  }
139 133
  
140 134
  typedef Undirector<SmartDigraph> UGraph;
141 135
  UGraph ugraph(graph);
142 136
  
143 137
  {
144 138
    HaoOrlin<UGraph, SmartDigraph::ArcMap<int> > ho(ugraph, cap1);
145 139
    ho.run();
146 140
    ho.minCutMap(cut);
147 141
    
148
    // BUG: The cut value should be 2
149
    check(ho.minCutValue() == 1, "Wrong cut value");
150
    // BUG: It should work
151
    //check(ho.minCutValue() == cutValue(ugraph, cap1, cut), "Wrong cut value");
142
    check(ho.minCutValue() == 2, "Wrong cut value");
143
    check(ho.minCutValue() == cutValue(ugraph, cap1, cut), "Wrong cut value");
152 144
  }
153 145
  {
154 146
    HaoOrlin<UGraph, SmartDigraph::ArcMap<int> > ho(ugraph, cap2);
155 147
    ho.run();
156 148
    ho.minCutMap(cut);
157 149
    
158
    // TODO: Check this cut value
159
    check(ho.minCutValue() == 4, "Wrong cut value");
160
    // BUG: It should work
161
    //check(ho.minCutValue() == cutValue(ugraph, cap2, cut), "Wrong cut value");
150
    check(ho.minCutValue() == 5, "Wrong cut value");
151
    check(ho.minCutValue() == cutValue(ugraph, cap2, cut), "Wrong cut value");
162 152
  }
163 153
  {
164 154
    HaoOrlin<UGraph, SmartDigraph::ArcMap<int> > ho(ugraph, cap3);
165 155
    ho.run();
166 156
    ho.minCutMap(cut);
167 157
    
168
    // TODO: Check this cut value
169 158
    check(ho.minCutValue() == 5, "Wrong cut value");
170
    // BUG: It should work
171
    //check(ho.minCutValue() == cutValue(ugraph, cap3, cut), "Wrong cut value");
159
    check(ho.minCutValue() == cutValue(ugraph, cap3, cut), "Wrong cut value");
172 160
  }
173 161

	
174 162
  return 0;
175 163
}
0 comments (0 inline)