130 likes | 210 Views
4. -4. Flow x feasible for capacity constraints x is feasible for b(1)=4 & b(4)=-4 . Is x min-cost-flow?. No, because: residual G(x) has nega-cycle W ( with c(W)=-1<0 ). nega-cycle W ={(3,4) (4,2) (2,3)} with c(W)=-1 and b = min { 4,3,2 } [i,j] W: x ij :=x ij +2.
E N D
4 -4 Flow x feasible for capacity constraints x is feasible for b(1)=4 & b(4)=-4 . Is x min-cost-flow? No, because: residual G(x) has nega-cycle W ( with c(W)=-1<0 )
nega-cycle W ={(3,4) (4,2) (2,3)} with c(W)=-1 andb = min {4,3,2} [i,j] W: xij:=xij +2
nega-cycle W ={(3,4) (4,2) (2,1) (1,3)} with c(W)=-1 andb = min {2, 1, 3, 2} [i,j] W: xij:=xij +1
Algorithm CYCLE (*for MCF*); Determine a feasible solution x ; (with maxflow) While nega-cycle in G(x) do identify such a nega-cycle W b := min { rij : {i,j} W} augment x along W withb update G(x) ; O(nm) } O(n) Initial flow x has cost cx <= mUC O(nm2 UC) time 10.5 withminimum mean cycles O(nm2 log n) iterations O(n2m3log n)
Let pi be a value on node i, for every node i pi pj 5 reduced cost: cp(i,j):= c(i,j)-pi +pj 2 3 -1 P=1-2-4-3 with c(P): 12+7+9=18 'reduced cost' cp(P): -3+18+2 For any path P: reduced cost cp(P) = -pa+c(P)+pb For any cycle W: reduced cost cp(W)=c(W) x=x* for c no c - nega cycle in G(x) no cp - nega cycle in G(x) x=x* for cp
no c - nega cycle in G(x) x=x* for c i.e. x not optimal there is a c - nega cycle in G(x) Proof Suppose cx*<cx. By equality x*=x+(x*-x) The difference flow x':=x*-x is a circular flow in G(x) -with all b(i)=0 We have c(x*)=cx+c(x*-x)=cx+cx', so cx'<0 Further x' is sum of O(m) cycles Wq ,so cx' = Sq c(Wq) Thus at least one cycles must have c-negative cost
Theorem 1 x=x* for c no c - nega cycle in G(x) no cp - nega cycle in G(x) x=x* for cp Theorem 2 x=x* p such that cp(i,j)>=0 for every [i,j] G(x) proof Assume x=x*. (No nega-cycle in G(x), so possible to) Compute c-shortest distances di w.r.t. arbitrary node s in G(x). For pi:=-di we have cp(i,j)=c(i,j)-pi+pj = c(i,j)+di-dj Now shortest path relations dj <=di +c(i,j) for [i,j] translate to cp(i,j)>=0 in G(x) Suppose for some p all reduced costs cp(i,j)>=0 in G(x) All cycles W in G(x) have cp(W)>=0, so (theorem 1) x is optimal
cij , rij and new values pi -2 -2 2 -3 -0 -2 0 -2 2 1 0 1 new reduced costs cP new d(i), Pst 2 -4 4 3 0 2 Pstwithb:= min {4,2,5,4,|-4|}}; Algorithm shortest-path-MCFLet x be MCF flow for pseudo-values bx(i);Define pi s.t. cp>=0 in G(x) ; (*e.g. x=0 andp=0*) i : e(i):=b(i)-bx(i); E:={i: e(i)>0}, D:={j: e(j)<0}; while E non-empty do select s in E and t in D in G(x): cp -shortest distances d from s and Pst; b:= min {rij : [i,j] in Pst} {e(s)} {-e(t)}; augment x along Pst with b; update G(x), E, D; p:=p-d ; (*N.B. again cp >=0 in G(x) *)
0 -2 2 1 0 1 p=(0,-2,-2,-3) 0 0 p*=(0,-2,-2,-3)–(0,0,1,1)= (0,0,-2,-3,-4) Pstwithb:= min {4,2,3, 2,|-2|}=2; Algorithm shortest-path-MCFLet x be MCF flow for pseudo-values bx(i);Define pi s.t. cp>=0 in G(x) ; (*e.g. x=0 andp=0*) i : e(i):=b(i)-bx(i); E:={i: e(i)>0}, D:={j: e(j)<0}; repeat select s in E and t in D in G(x): cp -shortest distances d from s and Pst; b:= min {rij : [i,j] in Pst} {e(s)} {-e(t)}; augment x along Pst with b; update G(x), E, D; p:=p-d ; (*N.B. again cp >=0 in G(x) *) until E empty cp*
Algorithm shortest-path-MCFLet x be MCF flow for pseudo-values bx(i);Define pi s.t. cp>=0 in G(x) ; (*e.g. x=0 andp=0*) i : e(i):=b(i)-bx(i); E:={i: e(i)>0}, D:={j: e(j)<0}; repeat select s in E and t in D in G(x): cp -shortest distances d from s and Pst; b:= min {rij : [i,j] in Pst} {e(s)} {-e(t)}; x' := x with b augmentation along Pst ; p' := p-d ; (*N.B. again c p'>=0 in G(x) *) x:=x' ; p' :=p, update G(x), E, D; until E empty ; case 2: [i,j] in G(x') but not in G(x) This means: x(j,i)=0 and x'(j,i)=b (or xij=uij and x'ij=uij-b), so so [j,i] on Pst and di = dj + cp(j,i) Now cp'(i,j)=c(i,j)-(pi-di)+(pj-dj)= =cp(i,j)+di-dj = -cp(j,i)+di-dj=0 Assume cp>=0 in G(x).Why: cp'>=0 in G(x') Proof: We check it for all arcs [i,j] of G(x') case 1: [i,j] is in G(x) and in G(x') cp'(i,j)=c(i,j)-(pi-di)+(pj-dj)=cp(i,j)+di-dj >=0, because with d as distance in network G(x), cp , we have dj <= di +cp(i,j) for [i,j] in G(x)
Algorithm shortest-path-MCFLet x be MCF flow for pseudo-values bx(i);Define pi s.t. cp>=0 in G(x) ; (*e.g. x=0 andp=0*) i : e(i):=b(i)-bx(i); E:={i: e(i)>0}, D:={j: e(j)<0}; repeat select s in E and t in D in G(x): cp -shortest distances d from s and Pst; b:= min {rij : [i,j] in Pst} {e(s)} {-e(t)}; x' := x with b augmentation along Pst ; p' := p-d ; (*N.B. again c p'>=0 in G(x) *) x:=x' ; p' :=p, update G(x), E, D; until E empty ; Complexiteit per iteratie O(m+n log n) (thepath-distance computation dominates). per iteratie Si in E ei decreases by at least one unit initieelSi in E ei <= Sbi <= nB with B largest supply O(nB (m+n log n) ) is O(n3) for B=1 in assignment problem