Network Flow & Linear Programming Network Flow Network Flow

6 downloads 127 Views 488KB Size Report
Linear Programming. Jeff Edmonds York University. Adapted from www.cse. yorku.ca/jeff/notes/3101/03.5-. NetworkFlow.ppt. •Instance: •A Network is a directed ...
Network Flow & Linear Programming

Jeff Edmonds York University Adapted from www.cse.yorku.ca/~jeff/notes/3101/03.5NetworkFlow.ppt

Network Flow

•Instance: •A Network is a directed graph G •Edges represent pipes that carry flow •Each edge has a maximum capacity c •A source node s in which flow arrives •A sink node t out which flow leaves

Goal: Max Flow

Adapted from www.cse.yorku.ca/~jeff/notes/3101/03.5NetworkFlow.ppt

Network Flow

•Instance: •A Network is a directed graph G •Edges represent pipes that carry flow •Each edge has a maximum capacity c •A source node s in which flow arrives •A sink node t out which flow leaves

Adapted from www.cse.yorku.ca/~jeff/notes/3101/03.5NetworkFlow.ppt

1

Network Flow

•Solution: •The amount of flow F through each edge.

•Flow can’t exceed capacity i.e. F  c. •Unidirectional flow F  0 and F = 0 Some texts: or F = -F F = 0 and d F  0

Adapted from www.cse.yorku.ca/~jeff/notes/3101/03.5NetworkFlow.ppt

Network Flow

•Solution: •The amount of flow F through each edge. •Flow F can’t exceed capacity c. •Unidirectional flow •No leaks, no extra flow.

Adapted from www.cse.yorku.ca/~jeff/notes/3101/03.5NetworkFlow.ppt

Network Flow

•Solution: •The amount of flow F through each edge. •Flow F cant exceed capacity c. •Unidirectional flow •No leaks, no extra flow. For each node v: flow in = flow out u F = w F Except for s and t.

Adapted from www.cse.yorku.ca/~jeff/notes/3101/03.5NetworkFlow.ppt

2

Network Flow

•Value of Solution: •Flow from s into the network minus flow from the network back into s. rate(F) = u F - v F = flow from network into t minus flow back in. = u F - v F

What about flow back into s?

Goal: Max Flow

Adapted from www.cse.yorku.ca/~jeff/notes/3101/03.5NetworkFlow.ppt

Network flow problem is a linear program Flow in G = (V,E): f: V x V R with 3 properties: 1) Capacity constraint: For all u,v  V : f(u,v) < c(u,v) 2) Skew symmetry:

For all u,v  V : f(u,v) = - f(v,u)

3) Flow conservation: For all u  V \ {s,t} :

 f(u,v) = 0

vV

Taken from www.infosun.fim.uni-passau.de/br/lehrstuhl/Kurse/Proseminar_ss01/Network_flow_problems.ppt

Adapted from www.cse.yorku.ca/~jeff/notes/3101/03.5NetworkFlow.ppt

3

Network Flow A network with its edge capacities

What is the maximum that can flow from s to t?

Adapted from www.cse.yorku.ca/~jeff/notes/3101/03.5NetworkFlow.ppt

Network Flow A network with its edge capacities

The max total rate of the flow is 1+2-0 = 3.

flow/capacity = 2/5 Can prove that total cannot be higher. Adapted from www.cse.yorku.ca/~jeff/notes/3101/03.5NetworkFlow.ppt

Network Flow

No more flow can be pushed along l the h top pathh because b the h edge is at capacity. Similarly, the edge . No flow is pushed along the bottom path because this would decrease the total from s to t. Adapted from www.cse.yorku.ca/~jeff/notes/3101/03.5NetworkFlow.ppt

4

Network Flow

is a minimum cut Its capacity is the sum of the capacities crossing the cut = 1+2 = 3. is not included in because it is going in the wrong direction.

Adapted from www.cse.yorku.ca/~jeff/notes/3101/03.5NetworkFlow.ppt

Network Flow

The edges crossing forward across the cut are at capacity those crossing backwards have zero flow. This is always true. Adapted from www.cse.yorku.ca/~jeff/notes/3101/03.5NetworkFlow.ppt

Maxflow = Mincut

The maximum flow is 1+2=3

The minimum cut is 1+2=3.

These are always equal.

Adapted from www.cse.yorku.ca/~jeff/notes/3101/03.5NetworkFlow.ppt

5

An Application: Matching Sam

Mary

Bob

Beth

John

Sue

Fred

Ann

3 matches 4 matches Can we do better?

Who loves whom. Who should be matched with whom so as many as possible matched and nobody matched twice?

Adapted from www.cse.yorku.ca/~jeff/notes/3101/0 3 5-NetworkFlow ppt

An Application: Matching

s

t 1

1 u

v

c = 1 •Total flow out of u  flow into u  1 •Boy u matched to at most one girl. c = 1 •Total flow into v = flow out of v  1 •Girl v matched to at most one boy. Adapted from www.cse.yorku.ca/~jeff/notes/3101/0 3 5-NetworkFlow ppt

Min Cut •Instance: •A Network is a directed graph G •Special nodes s and t. •Edges represent pipes that carry flow •Each edge has a maximum capacity c •Partition into two regions so that the cut between the two is minimized s

Adapted from www.cse.yorku.ca/~jeff/notes/3101/03.5NetworkFlow.ppt

t

6

Suggest Documents