[Lemon-commits] [lemon_svn] jacint: r621 - hugo/trunk/src/work/jacint
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:40:37 CET 2006
Author: jacint
Date: Thu Apr 29 13:09:12 2004
New Revision: 621
Modified:
hugo/trunk/src/work/jacint/preflow.cc
hugo/trunk/src/work/jacint/preflow.h
Log:
Comparison == changed to <=
Modified: hugo/trunk/src/work/jacint/preflow.cc
==============================================================================
--- hugo/trunk/src/work/jacint/preflow.cc (original)
+++ hugo/trunk/src/work/jacint/preflow.cc Thu Apr 29 13:09:12 2004
@@ -19,6 +19,7 @@
Graph::EdgeMap<int> cap(G);
readDimacsMaxFlow(std::cin, G, s, t, cap);
Timer ts;
+ bool error=false;
std::cout <<
"\n Testing preflow.h on a graph with " <<
@@ -61,8 +62,10 @@
min_cut_value == min_min_cut_value &&
min_min_cut_value == max_min_cut_value )
std::cout << "They are equal. " <<std::endl;
-
-
+ else {
+ std::cout << "ERROR! They are not equal! " <<std::endl;
+ error=true;
+ }
@@ -96,8 +99,12 @@
min_min_cut2_value == max_min_cut2_value )
std::cout <<", which is equal to all three min cut values."
<<std::endl;
-
-
+ else {
+ std::cout << "ERROR! It is not equal to all three min cut values! "
+ <<std::endl;
+ error=true;
+ }
+
@@ -148,7 +155,13 @@
", which is equal to the given flow value and to all three min cut values after phase 1."
<<std::endl;
}
-
+ else {
+ std::cout <<
+ "ERROR! It is not equal to the given flow value and to all three min cut values after phase 1! "
+ <<std::endl;
+ error=true;
+ }
+
@@ -195,6 +208,11 @@
min_min_cut4_value == max_min_cut4_value )
std::cout <<", which is equal to all three min cut values."
<<std::endl;
+ else {
+ std::cout << "ERROR! It is not equal to all three min cut values! "
+ <<std::endl;
+ error=true;
+ }
@@ -233,7 +251,14 @@
min_min_cut5_value == max_min_cut5_value )
std::cout <<", which is equal to all three min cut values."
<<std::endl<<std::endl;
-
+ else {
+ std::cout << "ERROR! It is not equal to all three min cut values! "
+ <<std::endl;
+ error=true;
+ }
+
+ if (error) std::cout <<"\nThere was some error in the results!\n"<<std::endl;
+ else std::cout <<"\nThere was no error in the results.\n"<<std::endl;
return 0;
}
Modified: hugo/trunk/src/work/jacint/preflow.h
==============================================================================
--- hugo/trunk/src/work/jacint/preflow.h (original)
+++ hugo/trunk/src/work/jacint/preflow.h Thu Apr 29 13:09:12 2004
@@ -153,10 +153,8 @@
break;
}
-// default:
-// break;
-// ZERO_FLOW ize kell
-
+ default:
+ break;
}
preflowPreproc( fe, active, level_list, left, right );
@@ -217,7 +215,7 @@
InEdgeIt e;
for(g->first(e,v); g->valid(e); g->next(e)) {
- if ( (*capacity)[e] == (*flow)[e] ) continue;
+ if ( (*capacity)[e] <= (*flow)[e] ) continue;
Node u=g->tail(e);
if ( level[u] >= n ) {
bfs_queue.push(u);
@@ -228,7 +226,7 @@
OutEdgeIt f;
for(g->first(f,v); g->valid(f); g->next(f)) {
- if ( 0 == (*flow)[f] ) continue;
+ if ( 0 >= (*flow)[f] ) continue;
Node u=g->head(f);
if ( level[u] >= n ) {
bfs_queue.push(u);
@@ -388,12 +386,12 @@
OutEdgeIt e;
for(g->first(e,w); g->valid(e); g->next(e)) {
- if ( (*flow)[e] == (*capacity)[e] ) continue;
+ if ( (*flow)[e] >= (*capacity)[e] ) continue;
Node v=g->head(e);
if( lev > level[v] ) { //Push is allowed now
- if ( excess[v]==0 && v!=t && v!=s ) {
+ if ( excess[v]<=0 && v!=t && v!=s ) {
int lev_v=level[v];
active[lev_v].push(v);
}
@@ -421,12 +419,12 @@
InEdgeIt e;
for(g->first(e,w); g->valid(e); g->next(e)) {
- if( (*flow)[e] == 0 ) continue;
+ if( (*flow)[e] <= 0 ) continue;
Node v=g->tail(e);
if( lev > level[v] ) { //Push is allowed now
- if ( excess[v]==0 && v!=t && v!=s ) {
+ if ( excess[v]<=0 && v!=t && v!=s ) {
int lev_v=level[v];
active[lev_v].push(v);
}
@@ -493,10 +491,10 @@
for(g->first(e,s); g->valid(e); g->next(e))
{
Num c=(*capacity)[e];
- if ( c == 0 ) continue;
+ if ( c <= 0 ) continue;
Node w=g->head(e);
if ( level[w] < n ) {
- if ( excess[w] == 0 && w!=t ) active[level[w]].push(w);
+ if ( excess[w] <= 0 && w!=t ) active[level[w]].push(w);
flow->set(e, c);
excess.set(w, excess[w]+c);
}
@@ -520,7 +518,7 @@
InEdgeIt e;
for(g->first(e,v); g->valid(e); g->next(e)) {
- if ( (*capacity)[e] == (*flow)[e] ) continue;
+ if ( (*capacity)[e] <= (*flow)[e] ) continue;
Node w=g->tail(e);
if ( level[w] == n && w != s ) {
bfs_queue.push(w);
@@ -534,7 +532,7 @@
OutEdgeIt f;
for(g->first(f,v); g->valid(f); g->next(f)) {
- if ( 0 == (*flow)[f] ) continue;
+ if ( 0 >= (*flow)[f] ) continue;
Node w=g->head(f);
if ( level[w] == n && w != s ) {
bfs_queue.push(w);
@@ -553,10 +551,10 @@
for(g->first(e,s); g->valid(e); g->next(e))
{
Num rem=(*capacity)[e]-(*flow)[e];
- if ( rem == 0 ) continue;
+ if ( rem <= 0 ) continue;
Node w=g->head(e);
if ( level[w] < n ) {
- if ( excess[w] == 0 && w!=t ) active[level[w]].push(w);
+ if ( excess[w] <= 0 && w!=t ) active[level[w]].push(w);
flow->set(e, (*capacity)[e]);
excess.set(w, excess[w]+rem);
}
@@ -565,10 +563,10 @@
InEdgeIt f;
for(g->first(f,s); g->valid(f); g->next(f))
{
- if ( (*flow)[f] == 0 ) continue;
+ if ( (*flow)[f] <= 0 ) continue;
Node w=g->tail(f);
if ( level[w] < n ) {
- if ( excess[w] == 0 && w!=t ) active[level[w]].push(w);
+ if ( excess[w] <= 0 && w!=t ) active[level[w]].push(w);
excess.set(w, excess[w]+(*flow)[f]);
flow->set(f, 0);
}
@@ -582,7 +580,7 @@
void relabel(Node w, int newlevel, VecStack& active,
VecNode& level_list, NNMap& left,
- NNMap& right, int& b, int& k, const bool what_heur ) {
+ NNMap& right, int& b, int& k, bool what_heur ) {
Num lev=level[w];
More information about the Lemon-commits
mailing list