Changeset 470:b64956c701c9 in lemon0.x
 Timestamp:
 04/29/04 13:09:12 (17 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@621
 Location:
 src/work/jacint
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

src/work/jacint/preflow.cc
r451 r470 20 20 readDimacsMaxFlow(std::cin, G, s, t, cap); 21 21 Timer ts; 22 bool error=false; 22 23 23 24 std::cout << … … 62 63 min_min_cut_value == max_min_cut_value ) 63 64 std::cout << "They are equal. " <<std::endl; 64 65 65 else { 66 std::cout << "ERROR! They are not equal! " <<std::endl; 67 error=true; 68 } 66 69 67 70 … … 97 100 std::cout <<", which is equal to all three min cut values." 98 101 <<std::endl; 99 100 102 else { 103 std::cout << "ERROR! It is not equal to all three min cut values! " 104 <<std::endl; 105 error=true; 106 } 107 101 108 102 109 … … 149 156 <<std::endl; 150 157 } 151 158 else { 159 std::cout << 160 "ERROR! It is not equal to the given flow value and to all three min cut values after phase 1! " 161 <<std::endl; 162 error=true; 163 } 164 152 165 153 166 … … 196 209 std::cout <<", which is equal to all three min cut values." 197 210 <<std::endl; 211 else { 212 std::cout << "ERROR! It is not equal to all three min cut values! " 213 <<std::endl; 214 error=true; 215 } 198 216 199 217 … … 234 252 std::cout <<", which is equal to all three min cut values." 235 253 <<std::endl<<std::endl; 236 254 else { 255 std::cout << "ERROR! It is not equal to all three min cut values! " 256 <<std::endl; 257 error=true; 258 } 259 260 if (error) std::cout <<"\nThere was some error in the results!\n"<<std::endl; 261 else std::cout <<"\nThere was no error in the results.\n"<<std::endl; 237 262 238 263 return 0; 
src/work/jacint/preflow.h
r469 r470 154 154 break; 155 155 } 156 // default: 157 // break; 158 // ZERO_FLOW ize kell 159 156 default: 157 break; 160 158 } 161 159 … … 218 216 InEdgeIt e; 219 217 for(g>first(e,v); g>valid(e); g>next(e)) { 220 if ( (*capacity)[e] == (*flow)[e] ) continue;218 if ( (*capacity)[e] <= (*flow)[e] ) continue; 221 219 Node u=g>tail(e); 222 220 if ( level[u] >= n ) { … … 229 227 OutEdgeIt f; 230 228 for(g>first(f,v); g>valid(f); g>next(f)) { 231 if ( 0 == (*flow)[f] ) continue;229 if ( 0 >= (*flow)[f] ) continue; 232 230 Node u=g>head(f); 233 231 if ( level[u] >= n ) { … … 389 387 for(g>first(e,w); g>valid(e); g>next(e)) { 390 388 391 if ( (*flow)[e] == (*capacity)[e] ) continue;389 if ( (*flow)[e] >= (*capacity)[e] ) continue; 392 390 Node v=g>head(e); 393 391 394 392 if( lev > level[v] ) { //Push is allowed now 395 393 396 if ( excess[v] ==0 && v!=t && v!=s ) {394 if ( excess[v]<=0 && v!=t && v!=s ) { 397 395 int lev_v=level[v]; 398 396 active[lev_v].push(v); … … 422 420 for(g>first(e,w); g>valid(e); g>next(e)) { 423 421 424 if( (*flow)[e] == 0 ) continue;422 if( (*flow)[e] <= 0 ) continue; 425 423 Node v=g>tail(e); 426 424 427 425 if( lev > level[v] ) { //Push is allowed now 428 426 429 if ( excess[v] ==0 && v!=t && v!=s ) {427 if ( excess[v]<=0 && v!=t && v!=s ) { 430 428 int lev_v=level[v]; 431 429 active[lev_v].push(v); … … 494 492 { 495 493 Num c=(*capacity)[e]; 496 if ( c == 0 ) continue;494 if ( c <= 0 ) continue; 497 495 Node w=g>head(e); 498 496 if ( level[w] < n ) { 499 if ( excess[w] == 0 && w!=t ) active[level[w]].push(w);497 if ( excess[w] <= 0 && w!=t ) active[level[w]].push(w); 500 498 flow>set(e, c); 501 499 excess.set(w, excess[w]+c); … … 521 519 InEdgeIt e; 522 520 for(g>first(e,v); g>valid(e); g>next(e)) { 523 if ( (*capacity)[e] == (*flow)[e] ) continue;521 if ( (*capacity)[e] <= (*flow)[e] ) continue; 524 522 Node w=g>tail(e); 525 523 if ( level[w] == n && w != s ) { … … 535 533 OutEdgeIt f; 536 534 for(g>first(f,v); g>valid(f); g>next(f)) { 537 if ( 0 == (*flow)[f] ) continue;535 if ( 0 >= (*flow)[f] ) continue; 538 536 Node w=g>head(f); 539 537 if ( level[w] == n && w != s ) { … … 554 552 { 555 553 Num rem=(*capacity)[e](*flow)[e]; 556 if ( rem == 0 ) continue;554 if ( rem <= 0 ) continue; 557 555 Node w=g>head(e); 558 556 if ( level[w] < n ) { 559 if ( excess[w] == 0 && w!=t ) active[level[w]].push(w);557 if ( excess[w] <= 0 && w!=t ) active[level[w]].push(w); 560 558 flow>set(e, (*capacity)[e]); 561 559 excess.set(w, excess[w]+rem); … … 566 564 for(g>first(f,s); g>valid(f); g>next(f)) 567 565 { 568 if ( (*flow)[f] == 0 ) continue;566 if ( (*flow)[f] <= 0 ) continue; 569 567 Node w=g>tail(f); 570 568 if ( level[w] < n ) { 571 if ( excess[w] == 0 && w!=t ) active[level[w]].push(w);569 if ( excess[w] <= 0 && w!=t ) active[level[w]].push(w); 572 570 excess.set(w, excess[w]+(*flow)[f]); 573 571 flow>set(f, 0); … … 583 581 void relabel(Node w, int newlevel, VecStack& active, 584 582 VecNode& level_list, NNMap& left, 585 NNMap& right, int& b, int& k, constbool what_heur ) {583 NNMap& right, int& b, int& k, bool what_heur ) { 586 584 587 585 Num lev=level[w];
Note: See TracChangeset
for help on using the changeset viewer.