COIN-OR::LEMON - Graph Library

Changeset 470:b64956c701c9 in lemon-0.x


Ignore:
Timestamp:
04/29/04 13:09:12 (20 years ago)
Author:
jacint
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@621
Message:

Comparison == changed to <=

Location:
src/work/jacint
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/work/jacint/preflow.cc

    r451 r470  
    2020  readDimacsMaxFlow(std::cin, G, s, t, cap);
    2121  Timer ts;
     22  bool error=false;
    2223 
    2324  std::cout <<
     
    6263       min_min_cut_value == max_min_cut_value )
    6364    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  }
    6669
    6770
     
    97100    std::cout <<", which is equal to all three min cut values."
    98101              <<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 
    101108
    102109
     
    149156              <<std::endl; 
    150157  }
    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 
    152165
    153166
     
    196209    std::cout <<", which is equal to all three min cut values."
    197210              <<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  }
    198216
    199217
     
    234252    std::cout <<", which is equal to all three min cut values."
    235253              <<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;
    237262
    238263  return 0;
  • src/work/jacint/preflow.h

    r469 r470  
    154154          break;
    155155        }
    156 //       default:
    157 //      break;
    158 //      ZERO_FLOW ize kell
    159 
     156      default:
     157        break;
    160158      }
    161159     
     
    218216        InEdgeIt e;
    219217        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;
    221219          Node u=g->tail(e);
    222220          if ( level[u] >= n ) {
     
    229227        OutEdgeIt f;
    230228        for(g->first(f,v); g->valid(f); g->next(f)) {
    231           if ( 0 == (*flow)[f] ) continue;
     229          if ( 0 >= (*flow)[f] ) continue;
    232230          Node u=g->head(f);
    233231          if ( level[u] >= n ) {
     
    389387      for(g->first(e,w); g->valid(e); g->next(e)) {
    390388           
    391         if ( (*flow)[e] == (*capacity)[e] ) continue;
     389        if ( (*flow)[e] >= (*capacity)[e] ) continue;
    392390        Node v=g->head(e);           
    393391           
    394392        if( lev > level[v] ) { //Push is allowed now
    395393         
    396           if ( excess[v]==0 && v!=t && v!=s ) {
     394          if ( excess[v]<=0 && v!=t && v!=s ) {
    397395            int lev_v=level[v];
    398396            active[lev_v].push(v);
     
    422420        for(g->first(e,w); g->valid(e); g->next(e)) {
    423421         
    424           if( (*flow)[e] == 0 ) continue;
     422          if( (*flow)[e] <= 0 ) continue;
    425423          Node v=g->tail(e);
    426424         
    427425          if( lev > level[v] ) { //Push is allowed now
    428426           
    429             if ( excess[v]==0 && v!=t && v!=s ) {
     427            if ( excess[v]<=0 && v!=t && v!=s ) {
    430428              int lev_v=level[v];
    431429              active[lev_v].push(v);
     
    494492            {
    495493              Num c=(*capacity)[e];
    496               if ( c == 0 ) continue;
     494              if ( c <= 0 ) continue;
    497495              Node w=g->head(e);
    498496              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);
    500498                flow->set(e, c);
    501499                excess.set(w, excess[w]+c);
     
    521519            InEdgeIt e;
    522520            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;
    524522              Node w=g->tail(e);
    525523              if ( level[w] == n && w != s ) {
     
    535533            OutEdgeIt f;
    536534            for(g->first(f,v); g->valid(f); g->next(f)) {
    537               if ( 0 == (*flow)[f] ) continue;
     535              if ( 0 >= (*flow)[f] ) continue;
    538536              Node w=g->head(f);
    539537              if ( level[w] == n && w != s ) {
     
    554552            {
    555553              Num rem=(*capacity)[e]-(*flow)[e];
    556               if ( rem == 0 ) continue;
     554              if ( rem <= 0 ) continue;
    557555              Node w=g->head(e);
    558556              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);
    560558                flow->set(e, (*capacity)[e]);
    561559                excess.set(w, excess[w]+rem);
     
    566564          for(g->first(f,s); g->valid(f); g->next(f))
    567565            {
    568               if ( (*flow)[f] == 0 ) continue;
     566              if ( (*flow)[f] <= 0 ) continue;
    569567              Node w=g->tail(f);
    570568              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);
    572570                excess.set(w, excess[w]+(*flow)[f]);
    573571                flow->set(f, 0);
     
    583581    void relabel(Node w, int newlevel, VecStack& active, 
    584582                 VecNode& level_list, NNMap& left,
    585                  NNMap& right, int& b, int& k, const bool what_heur ) {
     583                 NNMap& right, int& b, int& k, bool what_heur ) {
    586584
    587585      Num lev=level[w];
Note: See TracChangeset for help on using the changeset viewer.