Download
optimization n.
Skip this Video
Loading SlideShow in 5 Seconds..
Optimization PowerPoint Presentation
Download Presentation
Optimization

Optimization

97 Views Download Presentation
Download Presentation

Optimization

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Optimization Spring 2012 1

  2. Some practical remarks Lecturers: KristofferArnsfelt Hansen and Peter Bro Miltersen. Homepage: www.cs.au.dk/dOpt Exam: Written, 3 hours. There will be three compulsory assignments. If you want to transfer credit from last year, send email to arnsfelt@cs.au.dk with subject header “dOpt: transfer” as soon as possible and before March 1. The solution to the compulsory assignments should be handed in at specific tutorial and given to the instructor in person. Text: “Kompendium” available at GAD. 2

  3. FAQ about compulsory assignments Q: Do I really have to hand in all three assignments? A:YES! Q: Do I really have to hand in all three assignments on time? A:YES! Q: What if I can’t figure out how to solve them? A:Ask your instructor. Start solving them early, so that you will have sufficient time. Q: What if I get sick or my girlfriend breaks up or my hamster dies? A: Start solving them early, so that you will have sufficient time in case of emergencies. Q: Do I really have to hand in all three assignments? A:YES! 3

  4. The course in one slide Mixed Integer Linear Programming Worst case exponential time (more difficult to solve, but not impossible). Polynomial time (easy to solve) by Local Search. Linear Programming Min Cost Flow = reduction Max Flow Maximum matching Shortest paths 4

  5. Max Flow Max Flow was already covered in dADS The Ford-Fulkerson and Edmonds-Karp algorithms for solving max flow instances are not exam curriculum. Modelling concrete optimization problem using max flow is still exam curriculum. 5

  6. The Max Flow Problem 6

  7. Flow networks Flow networks are the problem instances of the max flow problem. A flow network is given by 1) a directed graph G = (V,E) 2) capacitiesc: E!R+. 3) The source s2V and the sinkt2V. Convention: c(u,v)=0 for (u,v) not in E. 7

  8. Flows Given flow network, a flow is a feasible solution to the max flow problem. A flow is a map f: V £V!R satisfying capacity constraints: 8 (u,v): f(u,v) ·c(u,v). Skew symmetry: 8 (u,v): f(u,v) = – f(v,u). Flow conservation: 8u2V – {s,t}: v2Vf(u,v) = 0 8

  9. A Flow 11 7 5 -2 2 1 10 5 4 9 9

  10. Skew Symmetry is modeled as -2 2 4 2 Our flows are net flows. 10

  11. Flow Conservation 11 7 1 5 uf(v3, u) = 0? 11

  12. Flow Conservation -7 11 7 1 5 -5 u f(v3, u) = (-7)+1+(-5)+11=0 12

  13. -7 11 7 1 5 -5 Flow enteringv3 = 12 Flow leavingv3 = 12 Flow conservation expresses that v3 is in balance. 13

  14. The max flow problem f(X,Y) := u 2X, v 2Yf(u,v). Value of f: |f| := f(s,V). The Max Flow Problem: Given a flow network (V,E,c,s,t), find the feasible flow f maximizing |f|. 14

  15. Algorithms for solving the Max Flow problem Ford-Fulkerson algorithm Edmonds-Karp algorithm Examples of the local search algorithmic pattern. 15

  16. Local Search Pattern LocalSearch(ProblemInstance x) y := feasible solution to x; while 9z∊N(y): v(z) > v(y)do y := z; od; returny; N(y) is a neighborhood of y. 16

  17. Local Search 17

  18. Local search checklist Design: How do we find the first feasible solution? Neighborhood design? Which neighbor to choose? Analysis: Partial correctness? (termination )correctness) Termination? Complexity? 18

  19. The first flow? 19

  20. The first flow? 0 0 0 0 0 0 0 0 0 20

  21. Neighborhood design Given a flow, how can we find a slightly different (and hopefully slightly better) flow? 21

  22. The first flow? 0 0 0 0 0 0 0 0 0 22

  23. Path Flows 4 4 4 Path Flow = flow with positive values only on a simple path from s to t 23

  24. Idea Let N(y) be the flows that can be obtained from y by adding a path flow (without violating the capacity bounds). The path flow we add should use some path in (V,E) along which every edge has some unused capacity. 24

  25. Example 1 1 1 s s t 1 1 25

  26. Example 1 1 0 0 1 0 s t 0 0 1 1 26

  27. Example 1 1 0 0 1 0 s t 0 0 1 1 27

  28. Another Path? No. 1 1 0 1 1 1 s t 0 1 1 1 28

  29. Optimal? 1 1 0 1 1 1 s t 0 1 1 1 29

  30. No! 1 1 1 1 1 0 s t 1 1 1 1 30

  31. Some remarks When designing a local search algorithm, the most obvious neighborhood relation is not necessarily the right one. That a solution cannot be improved by using some specified set of changes does not necessarily mean it is globally optimal. 31

  32. Better Idea The graph (V,E) is not really the right one to find paths in. The path flow we add should use some path in (V,Ef) where Ef is the set of edges that has unused capacity under the current flow f. Ef may include edges (u,v) 2E as well as back-edges (u,v) for which (v,u) 2E. 32

  33. The residual network Let G=(V,E,c,s,t) be a flow network and let f be a flow in G. The residual network is the flow network with edges and capacities Ef = {(u,v) 2V£V| f(u,v) < c(u,v)} cf(u,v) = c(u,v) - f(u,v) 33

  34. Augmenting Paths A simple path p from s to t in Gf is called an augmentingpath. Let cf(p) = min{ cf(u,v) : (u,v) is on p} Let fp(u,v) be cf(p) if (u,v) is on p -cf(p) if (v,u) is on p 0 otherwise Then fp is a path flow in Gf with value cf (p) 34

  35. Ford-Fulkerson method Ford-Fulkerson(G) f = 0 while(9 simple path p from s to t in Gf) f := f + fp outputf 35

  36. Design: How do we find the first feasible solution? Neighborhood design? Which neighbor to choose? Analysis: Partial correctness? (termination )correctness) Termination? Complexity? Local search checklist ٧ ٧ 36

  37. Cuts A cut (S,T)in G is a partition of V into S and T=V-S with s2S and t2T. Its capacityis c(S,T) = u2S, v2Tc(u,v) A minimum cut is a cut with smallest capacity among all cut. 37

  38. A cut S T c(S,T)=26 38

  39. Lemma 26.5 Let f be a flow in G and let (S,T) be a cut in G. Then |f| = f(S,T). 39

  40. Corollary 26.6 Let f be a flow in G and let (S,T) be a cut in G. Then |f| · c(S,T). This is a weak duality theorem. 40

  41. Max Flow – Min Cut Theorem Let f be a flow in G. The following three conditions are equivalent: 1. f is a maximum flow 2. Gf contains no augmenting path 3. There is a cut (S,T) so that |f|=c(S,T) 41

  42. Max Flow – Min Cut Theorem The value of the maximum flow in G is equal to the capacity of the minimum cut in G. This is a strong duality theorem. 42

  43. Flows vs Cuts The solution values agree, not the solutions themselves – flows and cuts are completely different objects. Given a max flow we can easily find a min cut (follows from proof of max flow-min cut theorem). Going the other way is less obvious. 43

  44. Consequence The Ford-Fulkerson method is partially correct, i.e., if it terminates it produces the flow with the maximum value. 44

  45. Local search checklist Design: How do we find the first feasible solution? Neighborhood design? Which neighbor to choose? Analysis: Partial correctness? (termination )correctness) Termination? Complexity? ٧ ٧ ٧ 45

  46. Termination Suppose all capacities are integers. We start with a flow of value 0. In each iteration, we get a new flow with higher integer value. We always have a legal flow, i.e., one of value at most the sum of capacities out of s. Hence, we can have at most a number of iterations equal to the sum of capacities out of s iterations. 46

  47. Correctness of Ford-Fulkerson Since Ford-Fulkerson is partially correct and it terminates if capacities are integers it is a correct algorithm for finding the maximum flow if capacities are integers. 47

  48. Integrality Theorem (26.11) If a flow network has integer valued capacities, there is a maximum flow with an integer value on every edge. The Ford-Fulkerson method will yield such a maximum flow. The integrality theorem is often extremely important when “programming” and modeling using the max flow formalism. 48

  49. Local search checklist Design: How do we find the first feasible solution? Neighborhood design? Which neighbor to choose? Analysis: Partial correctness? (termination )correctness) Termination? Complexity? ٧ ٧ ٧ ٧ 49

  50. Complexity The Ford-Fulkerson can be implemented to run in time at most O(|E|2 w), where w is the largest capacity. Is this fast? 50