Network Flow & Linear Programming Jeff Edmonds York University COSC 6111 Lecture 3 Network Flow Linear Programming.

Slides:



Advertisements
Similar presentations
Maximum flow Main goals of the lecture:
Advertisements

1 LP Duality Lecture 13: Feb Min-Max Theorems In bipartite graph, Maximum matching = Minimum Vertex Cover In every graph, Maximum Flow = Minimum.
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
1 Maximum flow sender receiver Capacity constraint Lecture 6: Jan 25.
Introduction To Algorithms CS 445 Discussion Session 8 Instructor: Dr Alon Efrat TA : Pooja Vaswani 04/04/2005.
CSCI 256 Data Structures and Algorithm Analysis Lecture 18 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some.
The Maximum Network Flow Problem. CSE Network Flows.
Chapter 10: Iterative Improvement The Maximum Flow Problem The Design and Analysis of Algorithms.
1 Maximum Flow w s v u t z 3/33/3 1/91/9 1/11/1 3/33/3 4/74/7 4/64/6 3/53/5 1/11/1 3/53/5 2/22/2 
1 Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Lectures on Network Flows
1 Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
1 COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf.
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
The max flow problem
Maximum Flows Lecture 4: Jan 19. Network transmission Given a directed graph G A source node s A sink node t Goal: To send as much information from s.
Minimum Cost Flow Lecture 5: Jan 25. Problems Recap Bipartite matchings General matchings Maximum flows Stable matchings Shortest paths Minimum spanning.
1 Network Flow & Linear Programming Jeff Edmonds York University COSC 3101 Lecture 5 Optimization Problems Network Flow Def nNetwork Flow Def n Simple.
1 Linear Programming Jeff Edmonds York University COSC 3101 Lecture 5 Def and Hot Dog Example Network Flow Def nNetwork Flow Def n Matrix View of Linear.
Linear Programming – Max Flow – Min Cut Orgad Keller.
Network Flow & Linear Programming Jeff Edmonds York University Adapted from NetworkFlow.ppt.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2004 Lecture 5 Wednesday, 10/6/04 Graph Algorithms: Part 2.
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
1 Ford-Fulkerson method Ford-Fulkerson(G) f = 0 while( 9 simple path p from s to t in G f ) f := f + f p output f Runs in time O(|f max | |E|) where f.
CS774. Markov Random Field : Theory and Application Lecture 13 Kyomin Jung KAIST Oct
CSE 421 Algorithms Richard Anderson Lecture 24 Network Flow Applications.
Theory of Computing Lecture 13 MAS 714 Hartmut Klauck.
1 Algorithmic Paradigms Jeff Edmonds York University COSC 2011 Lecture 9 Brute Force: Optimazation Problem Greedy Algorithm: Minimal Spanning Tree Dual.
1 COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf.
1 WEEK 11 Graphs III Network Flow Problems A Simple Maximum-Flow Algorithm Izmir University of Economics.
CS223 Advanced Data Structures and Algorithms 1 Maximum Flow Neil Tang 3/30/2010.
Chapter 7 April 28 Network Flow.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 25.
Chapter 7 May 3 Ford-Fulkerson algorithm Step-by-step walk through of an example Worst-case number of augmentations Edmunds-Karp modification Time complexity.
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 23.
CSEP 521 Applied Algorithms Richard Anderson Lecture 8 Network Flow.
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
Theory of Computing Lecture 12 MAS 714 Hartmut Klauck.
A directed graph G consists of a set V of vertices and a set E of arcs where each arc in E is associated with an ordered pair of vertices from V. V={0,
Maximum Flow Problem Definitions and notations The Ford-Fulkerson method.
1 Network Flow & Linear Programming Jeff Edmonds York University COSC 3101 Lecture 5 Optimization Problems Network Flow Def n Network Flow Def n Simple.
The Maximum Network Flow Problem
TU/e Algorithms (2IL15) – Lecture 8 1 MAXIMUM FLOW (part II)
The Maximum Network Flow Problem
Max-flow, Min-cut Network flow.
The Steepest Ascent Hill Climbing Algorithm
Finding a Path With Largest Smallest Edge
UNIT II OPTIMISATION ALGORITHMS
CS4234 Optimiz(s)ation Algorithms
Network Flow & Linear Programming
Richard Anderson Lecture 23 Network Flow
Lecture 22 Network Flow, Part 2
CSCI 3160 Design and Analysis of Algorithms Tutorial 8
Max-flow, Min-cut Network flow.
Network Flow 2016/04/12.
Richard Anderson Lecture 23 Network Flow
Richard Anderson Lecture 23 Network Flow
Richard Anderson Lecture 21 Network Flow
Flow Networks General Characteristics Applications
Algorithms (2IL15) – Lecture 7
EE5900 Advanced Embedded System For Smart Infrastructure
Network Flow.
Lecture 21 Network Flow, Part 1
Richard Anderson Lecture 22 Network Flow
Lecture 21 Network Flow, Part 1
Lecture 22 Network Flow, Part 2
Network Flow.
Richard Anderson Lecture 22 Network Flow
Maximum Flow Problems in 2005.
Presentation transcript:

Network Flow & Linear Programming Jeff Edmonds York University COSC 6111 Lecture 3 Network Flow Linear Programming

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

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 out of which flow leaves A sink node t into which flow arrives Goal: Max Flow 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 out of which flow leaves A sink node t into which flow arrives Network Flow

For 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.

Solution: The amount of flow F through each edge. Flow F can't exceed capacity c. No leaks, no extra flow. For each node v: flow in = flow out  u F =  w F 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 Goal: Max Flow Network Flow

Value Solution C= : cap(C) = how much can flow from U to V =  u  U,v  V c Min Cut s t U V u v Goal: Min Cut

Theorem: For all Networks Max F rate(F) = Min C cap(C) Prove:  F,C rate(F)  cap(C) Max Flow = Min Cut U V u v Prove:  flow F, alg either finds a better flow F or 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 less C witnesses that it can't be more.

u v f /c 0/c Flow Graph u v Augmentation Graph f +w w Walking c -F F +c c F c Network Flow

u v F /c 0/c Flow Graph u v Augmentation Graph F -w c -F F +c c F c w Walking Network Flow

Given Flow F Construct Augmenting Graph G F Find path P Let w be the max amount flow can increase along path P. Increase flow along path P by w. i.e newF = oldF + w × P +w -w Max Flow = Min Cut

Given Flow F Construct Augmenting Graph G F Find path P Let w be the max amount flow can increase along path P. Increase flow along path P by w. i.e newF = oldF + w × P +w -w Max Flow = Min Cut

Given Flow F Construct Augmenting Graph G F Find path P using BFS, DFS, or generic search algorithm No path Max Flow = Min Cut

Let F alg be this final flow. Let cut C alg =, where U are the nodes reachable from s in the augmented graph and V not. Claim: rate(F alg ) = cap(C alg ) Max Flow = Min Cut

An Application: Matching SamMary BobBeth JohnSue FredAnn Who loves whom. Who should be matched with whom so as many as possible matched and nobody matched twice? 3 matches Can we do better? 4 matches

An Application: Matching st c = 1 Total flow out of u  flow into u  1 Boy u matched to at most one girl. 1 c = 1 Total flow into v = flow out of v  1 Girl v matched to at most one boy. 1 u v

An Application: Matching st Flow st Augmentation Graph Augmentation Path Alternates adding edge removing edge adding edge removing edge adding edge Extra edge added st New Flow

An Application: Matching SamMary BobBeth JohnSue FredAnn Who loves whom. Who should be matched with whom so as many as possible matched and nobody matched twice? 3 matches Can we do better? 4 matches

Hill Climbing Problems: Can our Network Flow Algorithm get stuck in a local maximum? Local Max Global Max No!

Hill Climbing Problems: Running time? If you take small step, could be exponential time.

Network Flow

Add flow 1

Network Flow Add flow 1

Hill Climbing Problems: 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 edges Alg is poly time in number of nodes

Taking the biggest step possible

R_t = MaxFlow - F_t m * increase > sum_cut augment = sum_{e \in cut} C_e - F_e = value(cut_t) - F_t > min cut - F_t > M_t F_{t+1} = F_t + increase R_{t+1} = R_t – increase < R_t - [R_t / m] < (1-1/m)^t R_t < (1-1/m)^t F_0 < (1-1/m)^t MaxFlow < (1-1/m)^t sum_e C_e

Linear Programming

A Hotdog A combination of pork, grain, and sawdust, … Constraints: Amount of moistureAmount of moisture Amount of protein,Amount of protein, …

The Hotdog Problem Given today’s prices, what is a fast algorithm to find the cheapest hotdog?

There are deep ideas within the simplicity. =Abstraction Goal: Understand and think about complex things in simple ways. There are deep ideas within the simplicity. Rudich

Abstract Out Essential Details Cost: 29, 8, 1, 2 Amount to add: x 1, x 2, x 3, x 4 pork grainwater sawdust 3x 1 + 4x 2 – 7x 3 + 8x 4  12 2x 1 - 8x 2 + 4x 3 - 3x 4  24 -8x 1 + 2x 2 – 3x 3 - 9x 4  8 x 1 + 2x 2 + 9x 3 - 3x 4  31 Constraints: moisturemoisture protean,protean, … 29x 1 + 8x 2 + 1x 3 + 2x 4 Cost of Hotdog:

3x 1 + 4x 2 – 7x 3 + 8x 4  12 2x 1 - 8x 2 + 4x 3 - 3x 4  24 -8x 1 + 2x 2 – 3x 3 - 9x 4  8 x 1 + 2x 2 + 9x 3 - 3x 4  31 29x 1 + 8x 2 + 1x 3 + 2x 4 Subject to: Minimize: Abstract Out Essential Details

A Fast Algorithm For decades people thought that there was no fast algorithm. Then one was found! Theoretical Computer Science finds new algorithms every day. 3x 1 + 4x 2 – 7x 3 + 8x 4  12 2x 1 - 8x 2 + 4x 3 - 3x 4  24 -8x 1 + 2x 2 – 3x 3 - 9x 4  8 x 1 + 2x 2 + 9x 3 - 3x 4  31 29x 1 + 8x 2 + 1x 3 + 2x 4 Subject to: Minimize: 

Primal Dual

End