/
Network Flow &  Linear Programming Network Flow &  Linear Programming

Network Flow & Linear Programming - PowerPoint Presentation

anderson
anderson . @anderson
Follow
66 views
Uploaded On 2023-06-21

Network Flow & Linear Programming - PPT Presentation

Jeff Edmonds York University COSC 6111 Lecture 3 Network Flow Linear Programming Grad Algorithms Ingredients Instances The possible inputs to the problem Solutions for Instance ID: 1001082

network flow biggest step flow network step biggest path amount cut min increase time graph edges 3x4 matched max

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Network Flow & Linear Programming" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

1. Network Flow & Linear ProgrammingJeff EdmondsYork UniversityCOSC 6111Lecture 3Network FlowLinear ProgrammingGrad Algorithms

2. Ingredients: Instances: The possible inputs to the problem. Solutions for Instance: Each instance has an exponentially large set of solutions. Cost of Solution: Each solution has an easy to compute cost or value. Specification Preconditions: The input is one instance.Postconditions: An valid solution with optimal cost. (minimum or maximum)Optimization Problems

3. Instance: A Network is a directed graph G Edges represent pipes that carry flowEach edge <u,v> has a maximum capacity c<u,v>A source node s out of which flow leavesA sink node t into which flow arrivesGoal: Max FlowNetwork Flow

4. Instance: A Network is a directed graph G Edges represent pipes that carry flowEach edge <u,v> has a maximum capacity c<u,v> A source node s out of which flow leavesA sink node t into which flow arrivesNetwork Flow

5. Network FlowFor some edges/pipes, it is not clear which direction the flow should go in order to maximize the flow from s to t.Hence we allow flow in both directions.

6. Solution: The amount of flow F<u,v> through each edge.Flow F<u,v> can't exceed capacity c<u,v>.No leaks, no extra flow. For each node v: flow in = flow out u F<u,v> = w F<v,w>Network Flow

7. Value of Solution: Flow from s into the network minus flow from the network back into s. rate(F) = u F<s,u>- v F<v,s>Goal: Max FlowNetwork Flow

8. Value Solution C=<U,V>: cap(C) = how much can flow from U to V = uU,vV c<u,v>Min CutstUVuvGoal: Min Cut

9. Theorem:For all Networks MaxF rate(F) = MinC cap(C)Prove:  F,C rate(F)  cap(C)Max Flow = Min CutUVuvProve:  flow F, alg eitherfinds a better flow For finds cut C such that rate(F) = cap(C)Alg stops with an F and C for which rate(F) = cap(C)F witnesses that the optimal flow can't be lessC witnesses that it can't be more.

10. uvf<u,v>/c<u,v>0/c<v,u>Flow GraphuvAugmentation Graphf<u,v>+wwWalkingc<u,v>-F<u,v>F<u,v>+c<v,u>c<u,v>F<u,v>c<v,u>Network Flow

11. uvF<u,v>/c<u,v>0/c<v.u>Flow GraphuvAugmentation GraphF<u,v>-wc<u,v>-F<u,v>F<u,v>+c<v,u>c<u,v>F<u,v>c<u,v>wWalkingNetwork Flow

12. Given Flow FConstruct Augmenting Graph GFFind path P Let w be the max amount flowcan increase along path P. Increase flow along path P by w. i.e newF = oldF + w × P+w+w+w-wMax Flow = Min Cut

13. Given Flow FConstruct Augmenting Graph GFFind path P Let w be the max amount flowcan increase along path P. Increase flow along path P by w. i.e newF = oldF + w × P+w+w+w-wMax Flow = Min Cut

14. Given Flow FConstruct Augmenting Graph GFFind path P using BFS, DFS, or generic search algorithmNo pathMax Flow = Min Cut

15. Let Falg be this final flow.Let cut Calg=<U,V>, where U are the nodes reachable from s in the augmented graphand V not.Claim: rate(Falg) = cap(Calg)Max Flow = Min Cut

16. An Application: MatchingSamMaryBobBethJohnSueFredAnnWho loves whom.Who should be matched with whomso as many as possible matchedand nobody matched twice?3 matches Can we do better?4 matches

17. An Application: Matchingstc<s,u> = 1Total flow out of u = flow into u  1Boy u matched to at most one girl.1c<v,t> = 1Total flow into v = flow out of v  1Girl v matched to at most one boy.1uv

18. An Application: MatchingstFlowstAugmentation GraphAugmentation PathAlternates adding edgeremoving edgeadding edgeremoving edgeadding edgeExtra edge addedstNew Flow

19. An Application: MatchingSamMaryBobBethJohnSueFredAnnWho loves whom.Who should be matched with whomso as many as possible matchedand nobody matched twice?3 matches Can we do better?4 matches

20. Hill ClimbingProblems:Can our Network Flow Algorithm get stuck in a local maximum?Local MaxGlobal MaxNo!

21. Hill ClimbingProblems:Running time?If you take small step,could be exponential time.

22. Network Flow

23. Network FlowAdd flow 1

24. Network FlowAdd flow 1

25. Hill ClimbingProblems:Running time?If each iteration you take the biggest step possible,Alg is poly time in number of nodes and number of bits in capacities. If each iteration you take path with the fewest edgesAlg is poly time in number of nodes

26. Taking the biggest step possible

27. m = # edges l = # bits to specify capacities. The flow Ft must increase from 0 to up toTo be poly time, we could have Ft double each iteration.But it does not Taking the biggest step possibleF0 = 0FT = m2lm2lT = log(m) + l

28. Rt = How much the flow can increase by = MaxFlow - FtTo be poly time, we could have Rt half each iteration.Or decrease by a (1-1/m) factorTaking the biggest step possibleR0 = m2l= 0RT = 0

29. Rt = How much the flow can increase by = MaxFlow - FtChoose any cut C = U,V.Rt ≤ eC augmenteTaking the biggest step possiblestUVuv

30. Let wt = amount Ft increases = the min augment in augmenting path Let Cut = U,V where nodes uU are reachable from s with edges with augment amount > wt, i.e. the last graph in previous algorithm for which s is not reachable from t.eC augmente ≤ eC wt ≤ m wt (where m = # edges in graph)Taking the biggest step possiblestUVuv

31. Rt = MaxFlow – Ft ≤ eC augmente Taking the biggest step possible≤ m wt ≤ m  amount Ft increases≤ m  amount Rt decreasesRt+1 = Rt - amount Rt decreases≤ Rt – 1/m Rt= (1– 1/m) RtDecreasing by an mth!Does this stop after m iterations?No because as decreases, the decrease decreases.

32. Rt = How much the flow can increase by = MaxFlow - FtTo be poly time, we could have Rt decrease by a (1-1/m) factor each iterationTaking the biggest step possibleR0 = m2l= 0RT = 0Rt+1 ≤ (1– 1/m) RtEnd game: 1/2, 1/4, 1/8, 1/16, …. ? All flows are integers. Hence, decreasing RT < 1 is good enough.

33. Taking the biggest step possibleRt+1 ≤ (1– 1/m) RtRT ≤< 1(1– 1/m)T R0

34. Taking the biggest step possible< 1(1– 1/m)T R0(e-1/m)T R0

35. Taking the biggest step possible< 1(1– 1/m)T R0(e-1/m)T R0(e-T/m) R0-T/m + ln(R0) = ln(1) = 0T = m ln(R0) = m ln(m2l) = m (l + ln m)m = # edges l = # bits to specify capacities.

36. Linear Programming

37. A HotdogA combination of pork, grain, and sawdust, …Constraints: Amount of moistureAmount of protein,…

38. The Hotdog ProblemGiven today’s prices,what is a fast algorithm to find the cheapest hotdog?

39. There are deep ideas within the simplicity.=AbstractionGoal: Understand and think about complex things in simple ways. There are deep ideas within the simplicity.Rudich www.discretemath.com

40. Abstract Out Essential Details Cost: 29, 8, 1, 2Amount to add: x1, x2, x3, x4porkgrainwatersawdust3x1 + 4x2 – 7x3 + 8x4 ³ 122x1 - 8x2 + 4x3 - 3x4 ³ 24-8x1 + 2x2 – 3x3 - 9x4 ³ 8x1 + 2x2 + 9x3 - 3x4 ³ 31Constraints: moistureprotean,…29x1 + 8x2 + 1x3 + 2x4Cost of Hotdog:

41. 3x1 + 4x2 – 7x3 + 8x4 ³ 122x1 - 8x2 + 4x3 - 3x4 ³ 24-8x1 + 2x2 – 3x3 - 9x4 ³ 8x1 + 2x2 + 9x3 - 3x4 ³ 3129x1 + 8x2 + 1x3 + 2x4Subject to:Minimize:Abstract Out Essential Details

42. A Fast AlgorithmFor decades people thought that there was no fast algorithm.Then one was found!Theoretical Computer Sciencefinds new algorithms every day.3x1 + 4x2 – 7x3 + 8x4 ³ 122x1 - 8x2 + 4x3 - 3x4 ³ 24-8x1 + 2x2 – 3x3 - 9x4 ³ 8x1 + 2x2 + 9x3 - 3x4 ³ 3129x1 + 8x2 + 1x3 + 2x4Subject to:Minimize:»

43.

44. PrimalDual

45. End