Changeset 84:56e879edcca6 in lemon-0.x for src/work/jacint
- Timestamp:
- 02/17/04 10:34:55 (21 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@111
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/work/jacint/preflow_push_hl.h
r83 r84 66 66 void run() { 67 67 68 int i=0;//DELME69 70 68 typename Graph::NodeMap<int> level(G); 71 typename Graph::NodeMap<T> excess(G); 69 typename Graph::NodeMap<T> excess(G); 70 std::cout <<"excess s:"<<excess.get(s); //delme 72 71 73 int n=G.nodeNum(); 72 int n=G.nodeNum(); 74 73 int b=n-2; 75 74 /* … … 90 89 } 91 90 92 std::cout << "the level of t is " << bfs.dist(t);//delme93 94 91 level.set(s,n); 95 92 … … 100 97 if ( capacity.get(e) > 0 ) { 101 98 NodeIt w=G.head(e); 99 if ( excess.get(w) == 0 && w!=t && w!=s ) stack[level.get(w)].push(w); 102 100 flow.set(e, capacity.get(e)); 103 stack[level.get(w)].push(w);104 101 excess.set(w, excess.get(w)+capacity.get(e)); 105 102 } 106 103 } 107 104 108 109 105 /* 110 106 End of preprocessing … … 114 110 115 111 /* 116 Push/relabel on the highest level active Nodes.112 Push/relabel on the highest level active nodes. 117 113 */ 118 114 119 /*While there exists active Node.*/115 /*While there exists active node.*/ 120 116 while (b) { 121 117 … … 125 121 } else { 126 122 127 NodeIt w=stack[b].top(); //w is the highest label active Node.128 stack[b].pop(); //We delete w from the stack.123 NodeIt w=stack[b].top(); //w is a highest label active node. 124 stack[b].pop(); 129 125 130 int newlevel=2*n-2; //In newlevel we maintainthe next level of w.126 int newlevel=2*n-2; //In newlevel we bound the next level of w. 131 127 132 128 for(OutEdgeIt e=G.template first<OutEdgeIt>(w); e.valid(); ++e) { 133 NodeIt v=G.head(e); 134 /*e is the Edge wv.*/ 135 136 if (flow.get(e)<capacity.get(e)) { 137 /*e is an Edge of the residual graph */ 138 139 if(level.get(w)==level.get(v)+1) { 129 130 if ( flow.get(e) < capacity.get(e) ) { 131 /*e is an edge of the residual graph */ 132 133 NodeIt v=G.head(e); /*e is the edge wv.*/ 134 135 if( level.get(w) > level.get(v)+1 ) { std::cout<<"HIBA1!";} //delme 136 137 if( level.get(w) == level.get(v)+1 ) { 140 138 /*Push is allowed now*/ 141 139 … … 143 141 /*A nonsaturating push.*/ 144 142 145 if (excess.get(v)==0 && v != s ) stack[level.get(v)].push(v);143 if (excess.get(v)==0 && v != s && v !=t) stack[level.get(v)].push(v); 146 144 /*v becomes active.*/ 147 145 148 //std::cout<<++i;149 150 146 flow.set(e, flow.get(e)+excess.get(w)); 151 147 excess.set(v, excess.get(v)+excess.get(w)); … … 156 152 /*A saturating push.*/ 157 153 158 if (excess.get(v)==0 && v != s ) stack[level.get(v)].push(v);154 if (excess.get(v)==0 && v != s&& v !=t) stack[level.get(v)].push(v); 159 155 /*v becomes active.*/ 160 156 … … 194 190 /*A nonsaturating push.*/ 195 191 196 if (excess.get(v)==0 && v != s ) stack[level.get(v)].push(v);192 if (excess.get(v)==0 && v != s&& v !=t) stack[level.get(v)].push(v); 197 193 /*v becomes active.*/ 198 194 … … 205 201 /*A saturating push.*/ 206 202 207 if (excess.get(v)==0 && v != s ) stack[level.get(v)].push(v);203 if (excess.get(v)==0 && v != s&& v !=t) stack[level.get(v)].push(v); 208 204 /*v becomes active.*/ 209 205
Note: See TracChangeset
for help on using the changeset viewer.