CS4445/9544 Analysis of Algorithms II Solution for Assignment 1

Similar documents
Network Flows: Introduction & Maximum Flow

Graphs III - Network Flow

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

Network Flow. Data Structures and Algorithms Andrei Bulatov

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

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

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

Soviet Rail Network, 1955

1 Motivation and Basic Definitions

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

Today: Max Flow Proofs

Algorithm Design and Analysis

CSE 521: Design & Analysis of Algorithms I

Algorithmic Discrete Mathematics 6. Exercise Sheet

Main Reference: Sections in CLRS.

Randomized Perfect Bipartite Matching

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

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

Matching. Slides designed by Kevin Wayne.

Soviet Rail Network, 1955

Maximum Flow and Minimum Cut

Network Flows UPCOPENCOURSEWARE number 34414

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

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

Algorithm Design and Analysis

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)

18 Extensions of Maximum Flow

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

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

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

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

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

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

Reminder: Flow Networks

Introduction to Congestion Games

CSE 421 Introduction to Algorithms Winter The Network Flow Problem

EECE 301 Signals & Systems Prof. Mark Fowler

16 Max-Flow Algorithms and Applications

23 Maximum Flows and Minimum Cuts

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

Graph Theory: Network Flow

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

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

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

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.

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

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

Maximum Flow in Planar Graphs

u(t) Figure 1. Open loop control system

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

, 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

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

Network flows. The problem. c : V V! R + 0 [ f+1g. flow network G = (V, E, c), a source s and a sink t uv not in E implies c(u, v) = 0

Introduction to SLE Lecture Notes

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

Let. x y. denote a bivariate time series with zero mean.

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

Syntactic Complexity of Suffix-Free Languages. Marek Szykuła

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

Sample Final Exam (finals03) Covering Chapters 1-9 of Fundamentals of Signals & Systems

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

Network Flow Applications

Average Case Lower Bounds for Monotone Switching Networks

Maximum Flow 5/6/17 21:08. Presentation for use with the textbook, Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015

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

Stationary Distribution. Design and Analysis of Algorithms Andrei Bulatov

ARTIFICIAL INTELLIGENCE. Markov decision processes

CHAPTER 7: SECOND-ORDER CIRCUITS

16 Max-Flow Algorithms

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

Topics in Combinatorial Optimization May 11, Lecture 22

Algorithms. Algorithms 6.4 MAXIMUM FLOW

Chapter 7. Network Flow. CS 350: Winter 2018

18.03SC Unit 3 Practice Exam and Solutions

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

Efficient Algorithms for Computing Disjoint QoS Paths

5.2 GRAPHICAL VELOCITY ANALYSIS Polygon Method

Notes for Lecture 17-18

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

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

Price of Stability and Introduction to Mechanism Design

Chapter 6. Laplace Transforms

Maximum Network Lifetime in Wireless Sensor Networks with Adjustable Sensing Ranges

Exponential Sawtooth

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

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Civil and Environmental Engineering

arxiv: v1 [cs.cg] 21 Mar 2013

introduction Ford-Fulkerson algorithm

Dynamic Programming 11/8/2009. Weighted Interval Scheduling. Weighted Interval Scheduling. Unweighted Interval Scheduling: Review

Longest Common Prefixes

Random Walk with Anti-Correlated Steps

Bipartite Matching. Matching. Bipartite Matching. Maxflow Formulation

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

Explicit form of global solution to stochastic logistic differential equation and related topics

arxiv: v2 [cs.cg] 30 Apr 2015

on the interval (x + 1) 0! x < ", where x represents feet from the first fence post. How many square feet of fence had to be painted?

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

introduction Ford-Fulkerson algorithm

CS4800: Algorithms & Data Jonathan Ullman

An Inventory Replenishment Model for Deteriorating Items with Time-varying Demand and Shortages using Genetic Algorithm

Transcription:

Conider he following flow nework CS444/944 Analyi of Algorihm II Soluion for Aignmen (0 mark) In he following nework a minimum cu ha capaciy 0 Eiher prove ha hi aemen i rue, or how ha i i fale Uing he algorihm of Ford and Fulkeron we compue he maximum flow f hown in Figure (a) The flow i indicaed by he dahed arrow and he number below hem Since he flow ha value, he claim ha a minimum cu ha capaciy 0 i fale a by he maximum flow minimum cu heorem a minimum cu in he given nework ha capaciy a 0 7 7 a b 6 c b c d 0 d 9 G f (a) (b) ( mark) Find a minimum cu (S,T) eparaing from You need o indicae which verice are in S and which are in T Build he reidual nework G f for he maximum flow in Figure (a) and mark all he verice reachable from he ource verex (haded node in Figure (b) above) Thee verice are in he S ide of a minimum cu A minimum cu for he given flow nework i hen ({,a,b,c},{d,}) (0 mark) Le G = (V,E) be a flow nework wih ource, ink and a poiive ineger capaciy c(u,v) on every edge (u,v) E Le (S,T) be a minimum cu of G eparaing from Le k > 0 be a poiive ineger Claim If he capaciy of every edge (u,v) E i increaed by k, o he new capaciy of edge (u,v) i c (u,v) = c(u,v) +k, he cu (S,T) will ill be a minimum cu wih repec o he new capaciie Deermine wheher he above aemen i rue or fale If i i rue, give proof for i If i i fale, give an example proving he aemen wrong The claim i fale Conider he following flow nework in Figure (c) wih minimum cu ({,},{,,}) Le k = If he capaciy of every edge i increaed by, a hown in Figure (d), hen({,},{,,}) i no a minimum cu anymore a c({},{,,,}) = < c({,},{,,}) = 6

4 4 (c) (d) Le G = (V,E) be a flow nework wih ource, ink, and ineger capaciie A alway, le m be he number of edge and n be he number of verice of G Aume ha we are given a maximum flow f of G, ie we know he value of he flow f(u,v) on every edge (u,v) of G a (0 mark) Le he capaciy of a ingle edge (u,v) E be increaed by an ineger conan value k > 0 Wrie in peudocode, imilar o he one ued in cla, an O(m+n)-ime algorihm o compue a maximum flow for he modified flow nework Algorihm UpdaeFlow (G = (V,E),f,k) Inpu: Flow nework G = (V,E), flow funcion f and ineger conan value k; f i a maximum flow funcion for he nework before he capaciy of an edge wa increaed by k, G i he flow nework afer he capaciy of an edge wa increaed by k Oupu: Maximum flow funcion for G Build he reidual nework G f while G f ha a lea one augmening pah do { Find an augmening pah p in G f Compue he reidual capaciy c f (p) of p For each edge (u,v) p do f(u,v) f(u,v)+c f (p) Build he new reidual nework G f } Reurn f b (0 mark) Prove ha your algorihm compue a maximum flow To how ha he algorihm compue a maximum flow for he modified nework, we fir need o prove ha i erminae Noe ha by increaing he capaciy of a ingle edge by k he capaciy of a minimum cu, and hu he value of a maximum flow, increae by a mo k a well Hence he algorihm erminae a each ieraion of he while loop increae he value of he flow by a lea, o afer a mo k ieraion he algorihm mu erminae Noe ha building he reidual nework, compuing a reidual nework and updaing he value of he flow on he edge of an augmening pah all ake finie ime The algorihm compue a maximum flow of he modified nework becaue by he maximum flow minimum cu heorem, a flow funcion f i a maximum flow for a flow nework G = (V,E) if and only if G f ha no augmening pah The while loop of he above algorihm end only when G f ha no augmening pah and hence he flow reurned i a maximum flow c (0 mark) Show ha he ime complexiy of your algorihm i O(m+n)

Building he reidual nework require ime O(m + n) To deermine wheher G f ha augmening pah and o find an augmening pah p we can ue a deph fir earch algorihm, which run on O(m+n) ime Updaing he value of he flow on he edge of an augmening pah require O(n) ime a an augmening pah ha a mo n edge A menioned above, he while loop perform a mo k ieraion, hence he running ime of he while loop i O(k(m +n)) which i O(m +n) a k i conan Finally, o reurn he flow funcion f we need o pecify he value of he flow on every edge, which ake O(m) ime The ime complexiy of he algorihm i hen O(m+n) 4 A e P = {P,P,,P k } of k compuer program are o be execued by a group C = {C,C,,C l } of compuer The compuer program are claified inobype T,T,,T b, depending on how many compuer reource hey require Each compuer program P i ha a unique ype, T π(i) Each compuer C i can execue a e of a mo a(i) program, bu i can proce a mo a(i,j) program of ype T j, for each j =,,,b The problem i o aign all he program in P o he compuer o he he above condiion are aified, or o how ha uch an aignmen i no poible For example, aume ha here are 7 program {P,P,P,P 4,P,P 6,P 7 } of ype T, T, and T Program P and P are of ype T, program P, P 4, and P are of ype T and he oher one are of ype T There are compuer, C, C, and C : C can proce a mo program, of which could be of ype T and a mo could be of ype T, o a() =, a(,) =, a(,) =, and a(,) = 0 For C we have a() =, a(,) =, a(,) =, a(,) = For C we have a() =, a(,) =, a(,) = 0, a(,) = A oluion i o aign P and P 4 o C, P, P, and P 6 o C and P and P 7 o C i (0 mark) Wrie in peudocode an algorihm for olving hi problem If here i a way of aigning program o compuer, he algorihm mu reurn he value rue, oherwie i mu reurn he value fale Algorihm ProgramAignmen (P, T, C, a) Inpu: Se P of compuer program, e T = {T,T,,T b } of program ype, e C of compuer wih capaciie a Oupu: True, if all he program can be aigned o he compuer wihou exceeding he capaciie a(i) and a(i, j); fale oherwie Build a flow nework G = (V,E), where V = {,} P T C and E = {(,P i ) P i P,c(,P i ) = } {(P i,t π(i) ) P i P,T π(i) T,c(P i,t π(i) ) = } {(T j,c k ) T j T,C k C,c(T j,c k ) = a(k,j)} {(C k,) C k C,c(C k,) = a(k)} Compue a maximum flow f of G uing he algorihm of Ford and Fulkeron If f aurae all edge inciden on hen reurn rue ele reurn fale The following figure illurae he conrucion of he flow nework ii ( mark) Prove ha your algorihm correcly olve he above problem To prove ha he algorihm i correc, firwe need o how ha i erminae Graph G ha a finie number of verice and edge, o i can be conruced in finie ime Since G

P P P T T a(, ) a(, ) C C a() a() P k T b C l a(l) a(b, l) ha finie ize and all capaciie are ineger, he algorihm of Ford and Fulkeron finihe in finie ime Teing wheher he flow f aurae all edge inciden on he ource alo require a finie amoun of ime Hence, he algorihm alway erminae The algorihm reurn he value rue or fale, o he oluion produced by i i feaible To how ha he oupu of he algorihm i correc we need o how ha here i a flow f ha aurae all edge inciden on here i a feaible aignmen A of program o compuer ha doe no exceed he capaciie of he compuer a We how fir ha if here i a flow f ha aurae all edge inciden on here i a feaible aignmen A of program o compuer For hi we need o how how o conruc a feaible aignmen A given ha we know he value of he flow f on every edge of G A feaible aignmen A aign all program o compuer o ha he capaciie a(i) and a(i, j) of he compuer are no exceeded The aignmen A i conruced a follow For each program ype T i le P i = {P j f(p j,t i ) = }, o P i i he e of program of ype T i ha are o be aigned o compuer Program in P i are aigned o compuer a follow: The fir f(t i,c ) program of P i are aigned o C The nex f(t i,c ) program of P i are aigned o C The la f(t i,c l ) program of P i are aigned o C l Noe ha ince f aifie he flow conervaion propery, he above proce aign all program in P i o compuer Since all edge inciden on are auraed, hen f(,p i ) = f(p i,t π(i) ) = for each program P i and hu each program belong o ome e P j Therefore, by he above argumen each program i aigned o a compuer ThenumberofprogramofypeT j aignedocompuerc i if(t j,c i ) c(t j,c i ) = a(i,j) andheoalnumberofprogramaignedocompuerc i i T j T f(t j,c i ) = f(c i,) a(i), he fir equaliy hold becaue of he flow conervaion propery; hence he compuer capaciie are no exceeded and hu he above i a feaible aignmen of program o compuer b Finally, we how ha if herei a feaible aignmen A of all program o compuer here i a flow f ha aurae all edge inciden on We now how how o build he flow f from he aignmen A: 4

f(,p i ) = for each P i P f(p i,t π(i) ) = for each P i P f(t j,c i ) = number of program of ype T j ha A aign o compuer C i a(i,j), a A i a feaible aignmen of program o compuer f(c i,) = oal number of program aigned o compuer C i a(i), a A i a feaible aignmen of program o compuer The above flow funcion f aifie he capaciy conrain We how now ha i alo aifie he flow conervaion propery f(,p i ) = f(p i,t π(i) ) = for each program P i P, o flow conervaion i aified a each node P i P j P f(p j,t i ) = C j C f(t i,c j )foreachprogramypet i, a P j P f(p j,t i ) iequalohenumberofprogramofypet i andhivalueiequalo C j C f(t i,c j ) a all program of ype T i are aigned by A o compuer Hence, flow conervaion i aified on all node T i T T j T f(t j,c i ) = f(c i,) a T j T f(t j,c i ) i he oal number of program aigned o C i and hi number i equal o f(c i,) Hence flow conervaion i aified on all node C i C The above hen i a feaible flow funcion f ha aurae all edge inciden on (0 mark) Compue he ime complexiy of your algorihm The flow nework G conruced by he algorihm ha k +b+l+ node and a mo k + k + bl + l edge Hence building he flow nework require O(k + bl) ime The algorihm of Ford and Fulkeron require O(#edge f ) = O(k(k + bl)) ime a f k ince he cu ({},V \{}) ha capaciy k Finally, checking wheher all edge inciden on he ource are auraed require O(k) ime Hence, he ime complexiy of he algorihm i O(k(k +bl))