Download presentation

Presentation is loading. Please wait.

Published byMagdalene Joseph Modified over 2 years ago

1
MS&E 211 Minimum Cost Flow LP Ashish Goel

2
Minimum Cost Flow (MCF) Need to ship some good from “supply” nodes to “demand” nodes over a network – Example: the good could be crude oil; the network could be a network of pipelines; the supply nodes could be oil fields; the demand nodes could be refineries Assumption: The good is divisible, so we can ship fractional amounts of a good over an edge Fundamental problem: generalizes shortest paths; maximum compatibility matching; max- flow; and several problems we have seen already

3
Modeling the Network The network is modeled as a directed graph G – V = Set of nodes; E = Set of edges – N = number of nodes; M = number of edges – c(v,w) = cost of edge (v,w) – u(v,w) = capacity of edge (v,w) Capacity of the edge: the maximum amount of flow on the edge

4
Modeling the Network The network is modeled as a directed graph G – V = Set of nodes; E = Set of edges – N = number of nodes; M = number of edges – c(v,w) = cost of edge (v,w) – u(v,w) = capacity of edge (v,w) Capacity of the edge: the maximum amount of flow on the edge

5
Modeling the Network The network is modeled as a directed graph G – V = Set of nodes; E = Set of edges – N = number of nodes; M = number of edges – c(v,w) = cost of edge (v,w) – u(v,w) = capacity of edge (v,w) Capacity of the edge: the maximum amount of flow on the edge

6
Modeling Demands Demand of a node: The amount of the good that a node wants to consume Supply of a node: The amount of the good that a node wants to produce Modeled as a single number, d(v), for node v – d(v) is positive for “demand nodes” – d(v) is negative for “supply nodes” – d(v) = 0 otherwise

7
The Linear Program CONSERVATION CONSTRAINTS

8
The Linear Program CAPACITY CONSTRAINTS

9
Can Demands be Arbitrary? For the problem to be feasible, should the sum of the demands be 1.Strictly Negative? 2.Zero 3.Strictly Positive? 4.Doesn’t matter.

10
Can Demands be Arbitrary? For the problem to be feasible, should the sum of the demands be 1.Strictly Negative? 2.Zero 3.Strictly Positive? 4.Doesn’t matter.

11
The Linear Program SUMS TO ZERO, WHEN SUMMED OVER ALL NODES

12
The Linear Program MUST ALSO SUM TO ZERO, WHEN SUMMED OVER ALL NODES

13
Reduction to MCF Very powerful tool Suppose we are reducing a problem P to MCF Must specify how to obtain – The graph G (nodes, edges) – Edge capacities u and costs c – Node demands d from the parameters of the given problem P Must specify how the solution x to MCF gives a solution to P

14
A Simple Reduction Reducing Shortest Paths to MCF – Use the same graph G – Set d(s) = -1, d(t) = 1, d(v) = 0 for all other nodes – Set u(v,w) = 1 for all edges (v,w) (Or, set u(v,w) = ∞ for all edges (v,w)) – The solution x(v,w) to the MCF is also a solution to the shortest path problem Hence, MCF is more general than shortest paths

15
A Simple Example Every edge has a cost and a capacity, written as (c, u) (6,1) (2,1) (4,1) s t p q r (1,1) (2,1) (3,1) (4,1)

16
A Simple Example Every node has a demand (6,1) (2,1) (4,1) s t p q r (1,1) (2,1) (3,1) (4,1) d = -1 d = 1 d = 0

17
A Simple Example Every node has a demand (6, ∞) (2, ∞) (4, ∞) s t p q r (1, ∞) (2, ∞) (3, ∞) (4,∞) d = -1 d = 1 d = 0

18
Infinite Capacities? Can handle infinite capacity edges by just removing the capacity constraint for those edges For shortest paths – Setting capacity = ∞ guarantees that there will never be an optimum solution if there is a negative cost cycle – Setting capacity = 1 guarantees that there will be an optimum solution if there is a feasible solution

19
Next Steps Theory: Examine Basic Feasible Solutions Reductions: See two more examples Hands On: Solve the Shortest Path Problem again – Illustrate capacity constraints – A nice trick for generating the constraint matrix A

20
Minimum Cost Flow – Basic Feasible Solutions Ashish Goel

21
Main Theorem For an instance of a Minimum Cost Flow Problem, if (a) Every demand is integral and (b) Every capacity is integral then Every Basic Feasible Solution is Integral Very useful, since in many applications (eg. Shortest paths), fractional solutions do not make sense

22
Proof Sketch 1.Start with any feasible fractional solution 2.Find a cycle of edges (ignoring directions) such that every edge on the cycle has fractional flow 3.Show that along this cycle, flow can be increased a little clockwise, as well as counterclockwise The original fractional solution was an average of two other feasible solutions, and hence not a BFS

23
A Simple Example Labels on edges are (costs, capacities) (6,1) (2,1) (4,1) s t p q r (1,1) (2,1) (3,1) (4,1) d = -1 d = 1 d = 0

24
Step 1: Start With a Fractional Solution Labels on edges are flows 0.6 0 0 s t p q r 0.4 0.6 d = -1 d = 1 d = 0

25
Step 2: Find a Cycle of Fractionally Used Edges Labels on edges are flows 0.6 0 0 s t p q r 0.4 0.6 d = -1 d = 1 d = 0

26
Step 2: Find a Cycle of Fractionally Used Edges Labels on edges are flows 0.6 0 0 s t p q r 0.4 0.6 d = -1 d = 1 d = 0 Start with an arbitrary fractional edge

27
Step 2: Find a Cycle of Fractionally Used Edges Labels on edges are flows 0.6 0 0 s t p q r 0.4 0.6 d = -1 d = 1 d = 0 Start with an arbitrary fractional edge

28
Step 2: Find a Cycle of Fractionally Used Edges Labels on edges are flows 0.6 0 0 s t p q r 0.4 0.6 d = -1 d = 1 d = 0 Since t has integer demand, there must be another edge incident on t with fractional flow

29
Step 2: Find a Cycle of Fractionally Used Edges Labels on edges are flows 0.6 0 0 s t p q r 0.4 0.6 d = -1 d = 1 d = 0 Since t has integer demand, there must be another edge incident on t with fractional flow

30
Step 2: Find a Cycle of Fractionally Used Edges Labels on edges are flows 0.6 0 0 s t p q r 0.4 0.6 d = -1 d = 1 d = 0 Use the same argument at r

31
Step 2: Find a Cycle of Fractionally Used Edges Labels on edges are flows 0.6 0 0 s t p q r 0.4 0.6 d = -1 d = 1 d = 0 Use the same argument at r

32
Step 2: Find a Cycle of Fractionally Used Edges Labels on edges are flows 0.6 0 0 s t p q r 0.4 0.6 d = -1 d = 1 d = 0 Use the same argument at q

33
Step 2: Find a Cycle of Fractionally Used Edges Labels on edges are flows 0.6 0 0 s t p q r 0.4 0.6 d = -1 d = 1 d = 0 Use the same argument at q

34
Step 2: Find a Cycle of Fractionally Used Edges Labels on edges are flows 0.6 0 0 s t p q r 0.4 0.6 d = -1 d = 1 d = 0 Use the same argument at s

35
Step 2: Find a Cycle of Fractionally Used Edges Labels on edges are flows 0.6 0 0 s t p q r 0.4 0.6 d = -1 d = 1 d = 0 Use the same argument at s

36
Step 2: Find a Cycle of Fractionally Used Edges Labels on edges are flows 0.6 0 0 s t p q r 0.4 0.6 d = -1 d = 1 d = 0 We have our cycle

37
Step 2: Find a Cycle of Fractionally Used Edges Labels on edges are flows 0.6 0 0 s t p q r 0.4 0.6 d = -1 d = 1 d = 0 We have our cycle Strongly used the fact that demands are integer

38
Step 3: Find Two New Feasible Solutions Labels on edges are flows 0.6 0 0 s t p q r 0.4 0.6 d = -1 d = 1 d = 0 None of the edges on the cycle is at capacity

39
Step 3: Find Two New Feasible Solutions Labels on edges are flows 0.6 0 0 s t p q r 0.4 0.6 d = -1 d = 1 d = 0 None of the edges on the cycle is at capacity Strongly used the fact that capacities are integer

40
Step 3: Find Two New Feasible Solutions Labels on edges are flows 0.6 0 0 s t p q r 0.4 0.6 d = -1 d = 1 d = 0 Each edge on the cycle has non- zero flow

41
Step 3: Find Two New Feasible Solutions Labels on edges are flows 0.6 0 0 s t p q r 0.4 0.6 d = -1 d = 1 d = 0 Each edge on the cycle has non- zero flow Hence, can increase or decrease the flow on each edge

42
Step 3: Find Two New Feasible Solutions Labels on edges are flows 0.6 0 0 s t p q r 0.4 0.6 d = -1 d = 1 d = 0 Send some flow (say 0.1) “clockwise”

43
Step 3: Find Two New Feasible Solutions Labels on edges are flows 0.7 0 0 s t p q r 0.3 0.7 d = -1 d = 1 d = 0 Send some flow (say 0.1) “clockwise” Solution A

44
Step 3: Find Two New Feasible Solutions Labels on edges are flows 0.6 0 0 s t p q r 0.4 0.6 d = -1 d = 1 d = 0 Send some flow (say 0.1) “counter- clockwise”

45
Step 3: Find Two New Feasible Solutions Labels on edges are flows 0.5 0 0 s t p q r d = -1 d = 1 d = 0 Send some flow (say 0.1) “counter- clockwise” Solution B

46
Step 3: Find Two New Feasible Solutions Labels on edges are flows 0.6 0 0 s t p q r 0.4 0.6 d = -1 d = 1 d = 0 The average of Solutions A and B gives us the fractional solution we started with

47
Step 3: Find Two New Feasible Solutions Labels on edges are flows 0.6 0 0 s t p q r 0.4 0.6 d = -1 d = 1 d = 0 The average of Solutions A and B gives us the fractional solution we started with Hence, we did not start with a BFS

48
While we used a specific example, the proof is completely generalizable for any MCF with integer capacities and demands

49
Main Theorem For an instance of a Minimum Cost Flow Problem, if (a) Every demand is integral and (b) Every capacity is integral then Every Basic Feasible Solution is Integral Very useful, since in many applications (eg. Shortest paths), fractional solutions do not make sense

50
Minimum Cost Flow – Two Reductions Ashish Goel

51
Example: Matching Marry every man to exactly one woman, and vice-versa, while maximizing total compatibility C i,j : Compatibility of man i with woman j COMPATIBILTYHelenGloriaIris Dave100.5 Eddy0.7521 Frank0.52.51.5

52
Reduction to MCF DAVE EDDY FRANK HELEN GLORIA IRIS

53
Reduction to MCF DAVE EDDY FRANK HELEN GLORIA IRIS Cost = -compatibility Capacity = 1

54
Reduction to MCF DAVE EDDY FRANK HELEN GLORIA IRIS Cost = -compatibility Capacity = 1 WHAT SHOULD THE DEMAND OF DAVE BE IN THIS PROBLEM?

55
Reduction to MCF DAVE EDDY FRANK HELEN GLORIA IRIS Cost = -compatibility Capacity = 1 d = -1

56
Reduction to MCF DAVE EDDY FRANK HELEN GLORIA IRIS Cost = -compatibility Capacity = 1 d = -1 WHAT SHOULD THE DEMAND OF IRIS BE IN THIS PROBLEM?

57
Reduction to MCF DAVE EDDY FRANK HELEN GLORIA IRIS Cost = -compatibility Capacity = 1 d = -1 d = +1

58
Reduction to MCF DAVE EDDY FRANK HELEN GLORIA IRIS Cost = -compatibility Capacity = 1 d = -1 d = +1 x(v,w) The amount of marriage between man v and woman w

59
Reduction to MCF DAVE EDDY FRANK HELEN GLORIA IRIS Cost = -compatibility Capacity = ∞ d = -1 d = +1 x(v,w) The amount of marriage between man v and woman w

60
Basic Feasible Solutions for Matchings Any BFS for the Maximum Compatibility Matching problem written as a MCF must be an integer – Integer capacities and demands Interesting observation: The LP for the Maximum Compatibility Matching that we saw earlier is exactly the same as the LP for the corresponding MCF

61
(s,t) Max-Flow Problem Given a directed graph G with capacities (but no costs) on edges Given two special nodes in V: a source s and a terminus t Find the maximum amount of flow that can be sent from s to t

62
Example Labels on edges represent capacities, not costs Eyeballing: Optimum solution is to send 4 units of flow on top path, and 1 unit on bottom path 6 2 4 s t p q r 1 2 3 4

63
LP For (s,t) Max Flow

64
What is the optimum objective function value for this LP on our example graph? 6 2 4 s t q r 1 2 3 4 p

65
LP For (s,t) Max Flow What is the optimum objective function value for this LP on our example graph? Answer: 7 Not correct LP 6 2 4 s t q r 1 2 3 4 p

66
LP For (s,t) Max Flow

67
Reduction to MCF Start with an instance of the max-flow problem – Graph G with edge capacities – Missing: edge costs; node demands – Set each edge cost to 0, each node demand to 0 Add a new edge from t to s of infinite capacity and cost -1, to obtain an instance of MCF Intuition: MCF solution will try to minimize cost by pushing as much flow as possible from t to s – Since demands are all zero, this flow must travel back from s to t using edges in the original graph G

68
Example Reduction to MCF Start with max-flow problem: Labels on edges are (capacities) (6) (2) (4) s t p q r (2) (3) (4) (1)

69
Example Reduction to MCF Make edge costs 0: Labels on edges are (cost, capacity) (0, 6) (0,2) (0,4) s t p q r (0,2) (0,3) (0, 4) (0,1)

70
Example Reduction to MCF Add demands of 0 (0, 6) (0,2) (0,4) s t p q r (0,2) (0,3) (0, 4) d = 0 (0,1)

71
Example Reduction to MCF Add new fake edge (0, 6) (0,2) (0,4) s t p q r (0,1) (0,2) (0,3) (0, 4) d = 0 (-1, ∞)

72
Basic Feasible Solutions If each capacity in the (s,t) max-flow problem is integral, then any BFS to the resulting MCF problem LP is integral

73
Conclusion MCF is a very powerful class of LPs Reducing another problem to MCF allows us to use the structure of MCF Next: Simplex and Duality!

Similar presentations

OK

1 Maximum Flow Networks Suppose G = (V, E) is a directed network. Each edge (i,j) in E has an associated ‘capacity’ u ij. Goal: Determine the maximum amount.

1 Maximum Flow Networks Suppose G = (V, E) is a directed network. Each edge (i,j) in E has an associated ‘capacity’ u ij. Goal: Determine the maximum amount.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on nuclear family and joint family problems Ppt on global marketing Ppt on coalition government in uk Ppt on timing diagram of 8085 microprocessor Mba ppt on international monetary system Ppt on chapter 12 electricity companies Hrm ppt on recruitment 2016 Ppt on water scarcity in the world Ppt on op amp 741 Ppt on steps of farming