equal
deleted
inserted
replaced
114 int run(Node s, Node t, int k) { |
114 int run(Node s, Node t, int k) { |
115 |
115 |
116 //Resetting variables from previous runs |
116 //Resetting variables from previous runs |
117 total_length = 0; |
117 total_length = 0; |
118 |
118 |
119 FOR_EACH_LOC(typename Graph::EdgeIt, e, G){ |
119 for(typename Graph::EdgeIt e=loopFirst(typename Graph::EdgeIt(), (G)); e!=INVALID; ++e){ |
120 flow.set(e,0); |
120 flow.set(e,0); |
121 } |
121 } |
122 |
122 |
123 //Initialize the potential to zero |
123 //Initialize the potential to zero |
124 FOR_EACH_LOC(typename Graph::NodeIt, n, G){ |
124 for(typename Graph::NodeIt n=loopFirst(typename Graph::NodeIt(), (G)); n!=INVALID; ++n){ |
125 potential.set(n,0); |
125 potential.set(n,0); |
126 } |
126 } |
127 |
127 |
128 |
128 |
129 |
129 |
142 //There are no k paths from s to t |
142 //There are no k paths from s to t |
143 break; |
143 break; |
144 }; |
144 }; |
145 |
145 |
146 //We have to change the potential |
146 //We have to change the potential |
147 FOR_EACH_LOC(typename ResGraphType::NodeIt, n, res_graph){ |
147 //#define FOR_EACH_LOC(Ittype, e, g) for(Ittype e=loopFirst(Ittype(), (g)); (g).valid(e); (g).next(e)) |
|
148 //FOR_EACH_LOC(typename ResGraphType::NodeIt, n, res_graph){ |
|
149 for(typename ResGraphType::NodeIt n=loopFirst(typename ResGraphType::NodeIt(), (res_graph)); n!=INVALID; ++n){ |
148 potential[n] += dijkstra.distMap()[n]; |
150 potential[n] += dijkstra.distMap()[n]; |
149 } |
151 } |
150 |
152 |
151 |
153 |
152 //Augmenting on the sortest path |
154 //Augmenting on the sortest path |
193 /// |
195 /// |
194 ///\todo Is this OK here? |
196 ///\todo Is this OK here? |
195 bool checkComplementarySlackness(){ |
197 bool checkComplementarySlackness(){ |
196 Length mod_pot; |
198 Length mod_pot; |
197 Length fl_e; |
199 Length fl_e; |
198 FOR_EACH_LOC(typename Graph::EdgeIt, e, G){ |
200 //#define FOR_EACH_LOC(Ittype, e, g) for(Ittype e=loopFirst(Ittype(), (g)); (g).valid(e); (g).next(e)) |
|
201 //FOR_EACH_LOC(typename Graph::EdgeIt, e, G){ |
|
202 for(typename Graph::EdgeIt e=loopFirst(typename Graph::EdgeIt(), (G)); e!=INVALID; ++e){ |
199 //C^{\Pi}_{i,j} |
203 //C^{\Pi}_{i,j} |
200 mod_pot = length[e]-potential[G.head(e)]+potential[G.tail(e)]; |
204 mod_pot = length[e]-potential[G.head(e)]+potential[G.tail(e)]; |
201 fl_e = flow[e]; |
205 fl_e = flow[e]; |
202 // std::cout << fl_e << std::endl; |
206 // std::cout << fl_e << std::endl; |
203 if (0<fl_e && fl_e<capacity[e]){ |
207 if (0<fl_e && fl_e<capacity[e]){ |