[Lemon-commits] [lemon_svn] jacint: r111 - hugo/trunk/src/work/jacint
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:37:24 CET 2006
Author: jacint
Date: Tue Feb 17 10:34:55 2004
New Revision: 111
Modified:
hugo/trunk/src/work/jacint/preflow_push_hl.h
Log:
after debugging
Modified: hugo/trunk/src/work/jacint/preflow_push_hl.h
==============================================================================
--- hugo/trunk/src/work/jacint/preflow_push_hl.h (original)
+++ hugo/trunk/src/work/jacint/preflow_push_hl.h Tue Feb 17 10:34:55 2004
@@ -65,12 +65,11 @@
*/
void run() {
- int i=0;//DELME
-
typename Graph::NodeMap<int> level(G);
- typename Graph::NodeMap<T> excess(G);
+ typename Graph::NodeMap<T> excess(G);
+ std::cout <<"excess s:"<<excess.get(s); //delme
- int n=G.nodeNum();
+ int n=G.nodeNum();
int b=n-2;
/*
b is a bound on the highest level of an active node.
@@ -89,8 +88,6 @@
level.set(v, bfs.dist(v));
}
- std::cout << "the level of t is " << bfs.dist(t);//delme
-
level.set(s,n);
@@ -99,13 +96,12 @@
{
if ( capacity.get(e) > 0 ) {
NodeIt w=G.head(e);
+ if ( excess.get(w) == 0 && w!=t && w!=s ) stack[level.get(w)].push(w);
flow.set(e, capacity.get(e));
- stack[level.get(w)].push(w);
excess.set(w, excess.get(w)+capacity.get(e));
}
}
-
/*
End of preprocessing
*/
@@ -113,10 +109,10 @@
/*
- Push/relabel on the highest level active Nodes.
+ Push/relabel on the highest level active nodes.
*/
- /*While there exists active Node.*/
+ /*While there exists active node.*/
while (b) {
/*We decrease the bound if there is no active Node of level b.*/
@@ -124,29 +120,29 @@
--b;
} else {
- NodeIt w=stack[b].top(); //w is the highest label active Node.
- stack[b].pop(); //We delete w from the stack.
+ NodeIt w=stack[b].top(); //w is a highest label active node.
+ stack[b].pop();
- int newlevel=2*n-2; //In newlevel we maintain the next level of w.
+ int newlevel=2*n-2; //In newlevel we bound the next level of w.
for(OutEdgeIt e=G.template first<OutEdgeIt>(w); e.valid(); ++e) {
- NodeIt v=G.head(e);
- /*e is the Edge wv.*/
+
+ if ( flow.get(e) < capacity.get(e) ) {
+ /*e is an edge of the residual graph */
- if (flow.get(e)<capacity.get(e)) {
- /*e is an Edge of the residual graph */
+ NodeIt v=G.head(e); /*e is the edge wv.*/
+
+ if( level.get(w) > level.get(v)+1 ) { std::cout<<"HIBA1!";} //delme
- if(level.get(w)==level.get(v)+1) {
+ if( level.get(w) == level.get(v)+1 ) {
/*Push is allowed now*/
if (capacity.get(e)-flow.get(e) > excess.get(w)) {
/*A nonsaturating push.*/
- if (excess.get(v)==0 && v != s) stack[level.get(v)].push(v);
+ if (excess.get(v)==0 && v != s && v !=t) stack[level.get(v)].push(v);
/*v becomes active.*/
- //std::cout<<++i;
-
flow.set(e, flow.get(e)+excess.get(w));
excess.set(v, excess.get(v)+excess.get(w));
excess.set(w,0);
@@ -155,7 +151,7 @@
} else {
/*A saturating push.*/
- if (excess.get(v)==0 && v != s) stack[level.get(v)].push(v);
+ if (excess.get(v)==0 && v != s&& v !=t) stack[level.get(v)].push(v);
/*v becomes active.*/
excess.set(v, excess.get(v)+capacity.get(e)-flow.get(e));
@@ -193,7 +189,7 @@
if (flow.get(e) > excess.get(w)) {
/*A nonsaturating push.*/
- if (excess.get(v)==0 && v != s) stack[level.get(v)].push(v);
+ if (excess.get(v)==0 && v != s&& v !=t) stack[level.get(v)].push(v);
/*v becomes active.*/
flow.set(e, flow.get(e)-excess.get(w));
@@ -204,7 +200,7 @@
} else {
/*A saturating push.*/
- if (excess.get(v)==0 && v != s) stack[level.get(v)].push(v);
+ if (excess.get(v)==0 && v != s&& v !=t) stack[level.get(v)].push(v);
/*v becomes active.*/
excess.set(v, excess.get(v)+flow.get(e));
More information about the Lemon-commits
mailing list