April 3, The maximum flow problem. See class notes on website.

Similar documents
Network Flows: Introduction & Maximum Flow

Problem Set If all directed edges in a network have distinct capacities, then there is a unique maximum flow.

Graphs III - Network Flow

Algorithmic Discrete Mathematics 6. Exercise Sheet

Main Reference: Sections in CLRS.

The Residual Graph. 11 Augmenting Path Algorithms. Augmenting Path Algorithm. Augmenting Path Algorithm

1 Motivation and Basic Definitions

Randomized Perfect Bipartite Matching

Matching. Slides designed by Kevin Wayne.

Algorithm Design and Analysis

The Residual Graph. 12 Augmenting Path Algorithms. Augmenting Path Algorithm. Augmenting Path Algorithm

Algorithms and Data Structures 2011/12 Week 9 Solutions (Tues 15th - Fri 18th Nov)

Today: Max Flow Proofs

Flow networks. Flow Networks. A flow on a network. Flow networks. The maximum-flow problem. Introduction to Algorithms, Lecture 22 December 5, 2001

Soviet Rail Network, 1955

CS4445/9544 Analysis of Algorithms II Solution for Assignment 1

Soviet Rail Network, 1955

Greedy. I Divide and Conquer. I Dynamic Programming. I Network Flows. Network Flow. I Previous topics: design techniques

Maximum Flow and Minimum Cut

Network Flow. Data Structures and Algorithms Andrei Bulatov

CSE 521: Design & Analysis of Algorithms I

Reminder: Flow Networks

! Abstraction for material flowing through the edges. ! G = (V, E) = directed graph, no parallel edges.

Admin MAX FLOW APPLICATIONS. Flow graph/networks. Flow constraints 4/30/13. CS lunch today Grading. in-flow = out-flow for every vertex (except s, t)

CS 473G Lecture 15: Max-Flow Algorithms and Applications Fall 2005

4/12/12. Applications of the Maxflow Problem 7.5 Bipartite Matching. Bipartite Matching. Bipartite Matching. Bipartite matching: the flow network

16 Max-Flow Algorithms and Applications

Flow Networks. Ma/CS 6a. Class 14: Flow Exercises

CSC 364S Notes University of Toronto, Spring, The networks we will consider are directed graphs, where each edge has associated with it

MAXIMUM FLOW. introduction Ford-Fulkerson algorithm maxflow-mincut theorem

Max Flow, Min Cut COS 521. Kevin Wayne Fall Soviet Rail Network, Cuts. Minimum Cut Problem. Flow network.

Network Flows UPCOPENCOURSEWARE number 34414

Algorithm Design and Analysis

Introduction to Congestion Games

6/3/2009. CS 244 Algorithm Design Instructor: t Artur Czumaj. Lecture 8 Network flows. Maximum Flow and Minimum Cut. Minimum Cut Problem.

18 Extensions of Maximum Flow

Flow networks, flow, maximum flow. Some definitions. Edmonton. Saskatoon Winnipeg. Vancouver Regina. Calgary. 12/12 a.

Discussion Session 2 Constant Acceleration/Relative Motion Week 03

Average Case Lower Bounds for Monotone Switching Networks

To become more mathematically correct, Circuit equations are Algebraic Differential equations. from KVL, KCL from the constitutive relationship

EECE 301 Signals & Systems Prof. Mark Fowler

Today s topics. CSE 421 Algorithms. Problem Reduction Examples. Problem Reduction. Undirected Network Flow. Bipartite Matching. Problem Reductions

Network Flow Applications

Please Complete Course Survey. CMPSCI 311: Introduction to Algorithms. Approximation Algorithms. Coping With NP-Completeness. Greedy Vertex Cover

26.1 Flow networks. f (u,v) = 0.

Algorithms. Algorithms 6.4 MAXIMUM FLOW

Introduction to SLE Lecture Notes

Maximum Flow. Contents. Max Flow Network. Maximum Flow and Minimum Cut

23 Maximum Flows and Minimum Cuts

Exponential Sawtooth

Maximum Flow in Planar Graphs

Selfish Routing. Tim Roughgarden Cornell University. Includes joint work with Éva Tardos

3/3/2015. Chapter 7. Network Flow. Maximum Flow and Minimum Cut. Minimum Cut Problem

16 Max-Flow Algorithms

Physics 240: Worksheet 16 Name

Maximum Flow. How do we transport the maximum amount data from source to sink? Some of these slides are adapted from Lecture Notes of Kevin Wayne.

Price of Stability and Introduction to Mechanism Design

Laplace Transform. Inverse Laplace Transform. e st f(t)dt. (2)

Chapter 7: Inverse-Response Systems

KINEMATICS IN ONE DIMENSION

, the. L and the L. x x. max. i n. It is easy to show that these two norms satisfy the following relation: x x n x = (17.3) max

20/20 20/20 0/5 0/5 20/20 20/20 5/5 0/5 0/5 5/5 0/20 25/30 20/20 30/30 20/20 0/5 5/5 20/20 0/5 0/5 15/20 15/25 20/20 10/10

CSE 421 Introduction to Algorithms Winter The Network Flow Problem

6.8 Laplace Transform: General Formulas

PHYSICS 151 Notes for Online Lecture #4

Basic Tools CMSC 641. Running Time. Problem. Problem. Algorithmic Design Paradigms. lg (n!) (lg n)! (lg n) lgn n.2

Lecture 2-1 Kinematics in One Dimension Displacement, Velocity and Acceleration Everything in the world is moving. Nothing stays still.

They were originally developed for network problem [Dantzig, Ford, Fulkerson 1956]

Notes on cointegration of real interest rates and real exchange rates. ρ (2)

Biol. 356 Lab 8. Mortality, Recruitment, and Migration Rates

5.1 - Logarithms and Their Properties

CMPS 6610/4610 Fall Flow Networks. Carola Wenk Slides adapted from slides by Charles Leiserson

Buckling of a structure means failure due to excessive displacements (loss of structural stiffness), and/or

1 Review of Zero-Sum Games

Stability in Distribution for Backward Uncertain Differential Equation

Chapter 2. First Order Scalar Equations

u(t) Figure 1. Open loop control system

23.2. Representing Periodic Functions by Fourier Series. Introduction. Prerequisites. Learning Outcomes

NECESSARY AND SUFFICIENT CONDITIONS FOR LATENT SEPARABILITY

CHAPTER 7: SECOND-ORDER CIRCUITS

Notes for Lecture 17-18

ARTIFICIAL INTELLIGENCE. Markov decision processes

6.302 Feedback Systems Recitation : Phase-locked Loops Prof. Joel L. Dawson

Final Spring 2007

Math 2142 Exam 1 Review Problems. x 2 + f (0) 3! for the 3rd Taylor polynomial at x = 0. To calculate the various quantities:

) were both constant and we brought them from under the integral.

DETC2004/CIE ALGORITHMIC FOUNDATIONS FOR CONSISTENCY-CHECKING OF INTERACTION-STATES OF MECHATRONIC SYSTEMS

Inventory Analysis and Management. Multi-Period Stochastic Models: Optimality of (s, S) Policy for K-Convex Objective Functions

13.1 Circuit Elements in the s Domain Circuit Analysis in the s Domain The Transfer Function and Natural Response 13.

Longest Common Prefixes

Angular Motion, Speed and Velocity

7. NETWORK FLOW I. Lecture slides by Kevin Wayne Copyright 2005 Pearson-Addison Wesley. Last updated on 11/22/17 6:11 AM

Stat13 Homework 7. Suggested Solutions

7.5 Bipartite Matching. Chapter 7. Network Flow. Matching. Bipartite Matching

2. VECTORS. R Vectors are denoted by bold-face characters such as R, V, etc. The magnitude of a vector, such as R, is denoted as R, R, V

The Primal Simplex Approach to the QoS Routing Problem

EE Control Systems LECTURE 2

Timed Circuits. Asynchronous Circuit Design. Timing Relationships. A Simple Example. Timed States. Timing Sequences. ({r 6 },t6 = 1.

Homework sheet Exercises done during the lecture of March 12, 2014

Two Coupled Oscillators / Normal Modes

Transcription:

5.05 April, 007 The maximum flow problem See cla noe on webie.

Quoe of he day You ge he maxx for he minimum a TJ Maxx. -- ad for a clohing ore Thi wa he mo unkinde cu of all -- Shakepeare in Juliu Caear Ac

Goal of hi lecure Inroduce he maximum flow problem Dicu applicaion of flow Preen he Ford-Fulkeron max flow algorihm Preen he max-flow min-cu reul

The Maximum Flow Problem Direced Graph G = (N, A). Source Sink Capaciie u ij on arc (i,j) Maximize he flow ou of, ubjec o Flow ou of i = Flow ino i, for i or. A Nework wih Arc Capaciie The max flow problem i o end a much flow from he ource node o he ink node a poible ubjec o he following conrain:. The flow ino node i i he flow ou of node i for node i,.. The flow x ij on arc (i, j) aifie 0 x ij u ij, where u ij i he capaciy of arc (i, j).

Feaible flow Flow in arc (i, j) i a mo i capaciy Toal flow ino node = oal flow ou of node Toal flow ino node = oal flow ou of node capaciie 0 A feaible flow 5 For mo of he lecure, we will repreen capaciie uing he color cheme given here and given line hicknee. We do hi o ha our nework are no o buy wih o many number. I i confuing o have o look a boh capaciie and flow a he ame ime.

Two Infeaible flow capaciie 0 The capaciy of arc (, ) i violaed. The flow ou of node exceed he flow in. 0 6 Thi lide give he wo way ha a flow can be infeaible oher han he flow being negaive.

capaciie 0 A feaible flow A maximum flow 7

On repreening capaciie Uually capaciie are ju lied a number. We are uing color and hicknee in hi lecure o make he animaion eaier o follow. On any homework e, ju ue number. Don ue color or hicknee. 8

An applicaion of maximum flow In a college dormiory, uden wan o download a movie. They wan o know how many minue of he movie hey can download each econd. 9 Thi i a raighforward applicaion of max flow in ha we wan o end a many packe per econd from he download ie o he dorm.

An applicaion of maximum flow Sarbuck ha decided o creae a lurry pipeline o end coffee from Seale o reailer around he counry. How much coffee can i hip o MIT every day? 0 6 0 8 MIT 0 Thi i a illy applicaion. I i moivaed by an April fool joke by NPR radio abou 0 year ago. They had a ory ha ounded fully eriou abou a pipeline for hipping ho coffee from Seale o he Ea Coa. They wen ino grea deail abou he legal righ concerning puing pipe on people properie and abou he expene involved.

The maximum maching problem I CY P G Can you mach he ar of Grey Anaomy o a o ge four pair, wih each man and women mached exacly once? CT M M D hp://abc.go.com/primeim e/greyanaomy/bio For fan of Grey Anaomy, pleae do no be oo concerned abou he poible mache, which are only looely baed on he how. I waned o creae a problem in which he maximum number of mached pair would be. Bu if I ued real relaionhip from Grey Anaomy, i would be very imple o come up wih oluion in which all four women were mached o he men.

Tranforming Maching ino Max Flow I P All arc have capaciy. CY G CT M M D Find he max flow. To creae a max flow from he maching problem, we creae a ource node wih arc from he ource node o he women. And we add a ink node wih arc from he men o he ink node. And we direc he original arc from he women o he men. We pu a capaciy of on each arc. Now a flow of k uni from o correpond o a maching of k pair of peron. In hi cae, he maximum flow from o i, and i correpond o maching hree women o hree men.

Wha i he maximum number of arcdijoin - pah? Two pah are arc dijoin if hey have no arc in common. Solve a max flow problem where each capaciy i. 5 9 6 7 0 8 There are arc-dijoin - pah There are ome communicaion nework where communicaion i epecially criical. One way of proecing communicaion from a ource node o a ink node i o make ure ha here are muliple dijoin pah on which communicaion can be en. In hi cae, here are hree arc-dijoin pah on which communicaion can be en. Two pah are called arc-dijoin if he wo pah do no hare an arc in common.

Repreening he Max Flow a an LP capaciie x x x x x Repreening Arc flow max v.. x + x = v x = x + x x + x = x.. -x x = -v 0 x 0 x 0 x 0 x 0 x Here we repreen he max flow problem a a linear programming problem. I i common for he maximum flow o be repreened by a variable v.

max v.. x + x = v x = x + x x + x = x.. -x x = -v Flow ou of i - Flow ino i = 0 for i or. Le v = flow ou of and ino. max v. x + x = v -x + x + x = 0 -x -x + x = 0 -x -x = -v 0 x ij u ij for all (i,j) max v.. Σ j x j = v Σ j x ij Σ j x ji = 0 for each i or.. - Σ i x i = -v 0 x ij u ij for all (i,j) 5 Here i he ame formulaion. We hen generalize i o a max flow problem on an arbirary graph.

The Ford-Fulkeron Algorihm Eenial Subrouine: ending flow on a pah from o. Such a pah i called an augmening pah. The capaciy of he pah i he malle capaciy of an arc on he pah. capaciie A pah wih capaciy Wha i he remaining augmening pah? 6 In he early 950, Ford and Fulkeron worked for he Rand Corporaion. They became inereed in he max flow problem and oher flow problem, and ulimaely became he leading reearcher in hi area. The Ford-Fulkeron max flow algorihm i known a an augmening pah algorihm. A each ieraion, he algorihm mainain a feaible flow. The algorihm hen ucceively ge beer flow by ending flow along pah from o. Here we inroduce an augmening pah. We ubly change he definiion of an augmening pah a few lide from now.

On he FF Max Flow Algorihm capaciie The nework wih flow 0 The Ford-Fulkeron Algorihm will creae a erie of larger and larger flow. Conider, e.g., he flow x above. Look a (, ). x = ; for any flow, 0 x. If we ar wih x, hen we can decreae he flow in (, ) by and canno increae he flow in (, ) 7 The FF algorihm mainain a feaible flow a each ieraion. (Thi i analogou o he implex algorihm mainaining a baic feaible oluion a each ieraion; however, he FF algorihm i no a pecial cae of he implex algorihm.) For he algorihm o proceed, we keep rack of how much he flow can change in each arc a ubequen ieraion, aring from he feaible flow a hi ieraion.

Focuing on How Flow Can Change capaciie The nework wih flow 0 Look a (, ) If we ar wih a flow of in (, ), we can increae he flow by a much a, and we can decreae he flow by a much a. 8 To illurae he idea of how flow can change, uppoe we ar wih he feaible flow given in he diagram. Then le u focu on arc (, ) o illurae he poible change. You may ak wheher he algorihm would acually reduce he flow in (, ). The anwer i no. Bu he purpoe of hi lide and he nex few lide i o illurae how flow can change and he reidual nework. So, pleae accep for now he poibiliy ha flow in (, ) could decreae.

The Original and Reidual Nework Original Nework Decreaing flow in (, ) by i mahemaically equivalen o ending one uni of flow from o. The Reidual Nework We can end a many a uni from o and end a many a one uni from o. 9 Currenly he flow in arc (, ) i and he capaciy i. Thi permi u o increae he flow in (, ) by a mo one addiional uni. We can alo modify he curren flow by decreaing he flow in (, ) from o 0. Thi correpond o being permied o end negaive one uni of flow in (, ). Mahemaically, hi i equivalen o being permied o end a much a uni of flow from node o node. There are alernaive way of repreening he poibiliy of decreaing he flow in (, ) by a much a one. Raher han permiing negaive flow o be en, we add he backward arc (, ) and give i a capaciy of. You hould probably fir convince yourelf ha reducing he flow in (, ) by i equivalen o ending one uni of flow from node o node.

Focuing on How Flow Can Change capaciie The nework wih flow 0 Reidual capaciie The Reidual Nework 0 Raher han work wih he original capaciie and wih he curren flow a a given ieraion, we will work wih he reidual nework. The reidual capaciie eiher reflec ha he curren flow can be increaed (uch a he arc (, ) wih a reidual capaciy of ) or ele he reidual capaciie reflec ha he curren flow can be decreaed. For example, he flow in (, ) can be reduced from o 0, and hi i repreened by an arc (, ) wih a reidual capaciy of.

The Original and Reidual Nework Original Nework The Reidual Nework In general, uppoe ha capaciy i u ij and he curren flow i x ij. (The curren flow i he flow a ome age of he algorihm.) The reidual capaciie are r ij = u ij x ij r ji = x ij Thi i how reidual capaciie are defined in erm of he original capaciie and he curren flow a an ieraion.

Change in he reidual Nework Original Nework Suppoe ha we increae he flow in (, ) from o. Wha happen in he reidual nework. The Reidual Nework The reidual capaciie are r ij = u ij x ij r ji = x ij Noice ha if we end a uni of flow in (, ) hen he reidual capaciy of (, ) will decreae by one and he reidual capaciy of (, ) will increae by. Similarly, if we were o reduce he flow in (, ) by, hi correpond o ending one uni of flow in (, ) in he reidual nework. In hi cae, he reidual capaciy of (, ) would decreae by one, and he reidual capaciy of (, ) would increae by.

The Ford-Fulkeron Algorihm Eenial Subrouine: ending flow on a pah from o in he reidual nework G(x). Such a pah i called an augmening pah. The capaciy of he pah i he malle reidual capaciy of an arc on he pah. Reidual capaciie The Reidual Nework Wha oher pah could have been eleced? Now ha you are familiar wih he concep of reidual nework we can alk abou he Ford-Fulkeron augmening pah algorihm. I acually a very imple algorihm if decribed in erm of he reidual nework. We fir decribe augmening pah in erm of he reidual nework.

The Ford Fulkeron Maximum Flow Algorihm Begin x := 0; while here i ome direced pah from o in G(x) do begin end le P be a pah from o in G(x); end δ(p) uni of flow along P; updae x and G(x); end {he flow x i now maximum}. The FF algorihm ieraively end flow along augmening pah unil here i no augmening pah remaining.

Augmening Pah Theorem A flow i a maximum - flow if and only if here i no augmening pah from o in he reidual nework. 5

Menal Break: More people who go i wrong. Nobody now fear ha a Japanee flee could deal an unexpeced blow a our Pacific poeion... Radio make urprie impoible. -- Joephu Daniel, 9 While heoreically and echnically eleviion may be feaible, commercially and financially I conider i an impoibiliy, a developmen of which we need wae lile ime dreaming. -- Lee De Fore, 96 Wha can be more palpably aburd han he propec held ou of locomoive ravelling wice he peed of agecoache? -- Quarerly Review, 85 6

I can be aken for graned ha before 980 hip, aircraf, locomoive and even auomobile will be aomically fueled. -- David Sarnoff, 955 The OR group a CN Rail wa aked by he managemen o find a way o decreae he number of rain crahe. Afer exhauive aiical analyi and compuer imulaion hey found ha wih large aiical ignificance he car mo involved in crahe wa he la car of he rain. Their recommendaion o managemen: remove he la car from all he CN rain. -- Source :Ira Hammerman, ORCS-L /9/95. 7

Ford-Fulkeron Max Flow reidual arc 5 Thi i he original nework, and he original reidual nework. 8 We illurae he FF augmening pah algorihm on hi nework. The animaion i conained in he file eniled FF Max Flow.pp.

Ford-Fulkeron Max Flow 5 Here i he opimal flow 9 The algorihm erminae afer five ieraion wih hi maximum flow. In fac, i could have had fewer augmenaion if we had choen differen augmening pah.

Commen on he number of augmenaion in he Ford-Fulkeron Max Flow Algorihm If a good augmening pah i found, he algorihm can be efficien fewe number of arc augmenaion wih large capaciy I can be errible if one i permied o chooe bad augmening pah Bu i i finie o long a he daa i all ineger valued. And he opimum flow are inegral o long a he daa i inegral. 0 The FF augmening pah algorihm can be painfully low. Even wih a nework wih only 5 arc, i i poible o ake rillion of ieraion if he augmening pah are choen upidly. Forunaely, here are wo imple rule for chooing he augmening pah ha lead o provably efficien implemenaion of he max flow algorihm.

Cu in Nework reidual arc 5 A cu in a nework i a pariion of he node ino wo par, denoed S and T. An - cu in a nework i a cu in which S, and T. The dualiy heory for max flow i very famou. Imporan example of i predae dualiy for linear programming. Here we inroduce he concep of cu. In paricular, we focu on cu ha eparae he ource node from he ink node. We call uch cu: - cu.

Cu in Nework reidual arc 5 The arc of he cu (S, T) are he arc originaing in S and ending in T. The capaciy of he cu (S, T) i he um of he capaciy of he arc of he cu. The capaciy of (S, T) i 7. The capaciy of he cu (S, T) i he maximum amoun of flow ha can be en from S o T, and hu i an upper bound on he amoun of flow ha can be en from o.

Cu in Nework reidual arc 5 Wha i he capaciy 9 of (S, T) Wha i he capaciy of (S, T) 5 if S = {,, }? if S = {,,,, 5}? A wih many concep, i help o work ou a few example o make ure ha you know he definiion.

Cu Dualiy reidual arc S 5 The capaciy of every - cu i a lea he value of he maximum flow. All flow from o mu a ome poin cro from S o T. So, he max flow i a mo 9. Since all flow from o much evenually be en from S o T, he capaciy of (S, T) i an upper bound on he max flow en from o.

Max Flow = Min Cu reidual arc 5 T The maximum flow from o i alway equal o he minimum capaciy of an - cu. Min Cu: S = {,,,, 5}, T = {}. Capaciy = 5. 5 The max flow i alway equal o he min cu. In ome ene, hi i a pecial cae of linear programming dualiy. Bu for he purpoe of 5.05, i i ufficien o view i a analogou o LP dualiy.

Max Flow = Min Cu I P All arc have capaciy. CY G CT M M D A cu wih capaciy 6 Recall ha he max flow from o i in hi example, and o he maximum ize of a maching i. By he max-flow min-cu heorem, here i an - cu wih capaciy. The - cu wih capaciy i illuraed on hi diagram. If we were o eliminae he hree arc of he cu, hen here would be no pah from o a all. In general, eliminaing all arc of any - cu will eliminae all pah from o in he nework.

Max Flow = Min Cu A Nework wih Arc Capaciie Min cu: S = {, }. Capaciy =. 7 Here i anoher illuraion of max flow = min cu.

Max Flow = Min Cu 5 9 6 7 0 8 8 Min cu: S = {,,, 8}. Capaciy =. 8 Here i anoher illuraion of max flow = min cu.

A imple and very bad example M M M M 9 Thi example how ha i i poible o have M augmenaion in hi graph wih four node and five arc if one chooe augmenaion in a pervere manner, a illuraed on he nex lide. if M = rillion, hi would reul in rillion augmenaion. A he ame ime, i i poible o find a max flow in augmenaion if he augmening pah are -- and --.

Afer augmenaion M- M M M- 0

Afer wo augmenaion M- M- M- M-

Afer augmenaion M- M- M- M-

And o on

Afer M augmenaion M M M M

Iniial Applicaion of Flow Miliary operaion in Europe General F. S. Ro developed he model brough he model o Ford and Fulkeron a Rand Evaluae he capaciy of he Eaern European rail nework o uppor a convenional war. 5

And now, i ime for.. 6

Summary Ford-Fulkeron Algorihm Dualiy Theory: Max Flow = Min Cu 7