Network Design and Optimization course

Similar documents
and 6.855J March 6, Maximum Flows 2

Graphs and Network Flows IE411. Lecture 13. Dr. Ted Ralphs

Network flows and Menger s theorem

Tutorial for Algorithm s Theory Problem Set 5. January 17, 2013

Lecture 3: Graphs and flows

Jessica Su (some parts copied from CLRS / last quarter s notes)

Final Exam Spring 2003

Network Flows. 1. Flows deal with network models where edges have capacity constraints. 2. Shortest paths deal with edge costs.

Today. Maximum flow. Maximum flow. Problem

Chapter 5 Graph Algorithms Algorithm Theory WS 2012/13 Fabian Kuhn

Outline: Finish uncapacitated simplex method Negative cost cycle algorithm The max-flow problem Max-flow min-cut theorem

Maximum Flow. Flow Networks. Flow Networks Ford-Fulkerson Method Edmonds-Karp Algorithm Push-Relabel Algorithms. Example Flow Network

CSE 417 Network Flows (pt 4) Min Cost Flows

Maximum flow problem CE 377K. March 3, 2015

1. Lecture notes on bipartite matching

1 Matchings in Graphs

Mathematical and Algorithmic Foundations Linear Programming and Matchings

16.1 Maximum Flow Definitions

Solutions for the Exam 6 January 2014

Math 5490 Network Flows

Lecture 10,11: General Matching Polytope, Maximum Flow. 1 Perfect Matching and Matching Polytope on General Graphs

Source. Sink. Chapter 10: Iterative Programming Maximum Flow Problem. CmSc250 Intro to Algorithms

1 Introduction. 2 The Generic Push-Relabel Algorithm. Improvements on the Push-Relabel Method: Excess Scaling. 2.1 Definitions CMSC 29700

1. Lecture notes on bipartite matching February 4th,

CSE 417 Network Flows (pt 3) Modeling with Min Cuts

Homework 3 Solutions

Lecture 11: Maximum flow and minimum cut

Maximum flows & Maximum Matchings

Matching Theory. Figure 1: Is this graph bipartite?

Graphs and Network Flows IE411. Lecture 21. Dr. Ted Ralphs

LECTURES 3 and 4: Flows and Matchings

Matching Algorithms. Proof. If a bipartite graph has a perfect matching, then it is easy to see that the right hand side is a necessary condition.

Copyright 2007 Pearson Addison-Wesley. All rights reserved. A. Levitin Introduction to the Design & Analysis of Algorithms, 2 nd ed., Ch.

CSE 5311 Notes 9: Maximum Flows

CS261: Problem Set #1

Graphs and Network Flows ISE 411. Lecture 7. Dr. Ted Ralphs

Notes for Lecture 20

Material handling and Transportation in Logistics. Paolo Detti Dipartimento di Ingegneria dell Informazione e Scienze Matematiche Università di Siena

Minimum Cost Edge Disjoint Paths

CS261: Problem Set #2

Sublinear-Time Parallel Algorithms. for Matching and Related Problems. Andrew V. Goldberg y. Stanford University. Stanford, CA 94305

x ji = s i, i N, (1.1)

Maximum Flow Algorithms

Cuts, Connectivity, and Flow

SEQUENTIAL AND PARALLEL ALGORITHMS FOR MINIMUM FLOWS

CS261: A Second Course in Algorithms Lecture #3: The Push-Relabel Algorithm for Maximum Flow

CS/COE 1501 cs.pitt.edu/~bill/1501/ Network Flow

CS599: Convex and Combinatorial Optimization Fall 2013 Lecture 14: Combinatorial Problems as Linear Programs I. Instructor: Shaddin Dughmi

Lecture 3: Totally Unimodularity and Network Flows

Parallel Breadth First Search

Combinatorial optimization - Structures and Algorithms, GeorgiaTech, Fall 2011 Lectures 1 4: Aug 23 Sep 1

Solving problems on graph algorithms

Matchings. Saad Mneimneh

Network Design and Optimization course

Module 7. Independent sets, coverings. and matchings. Contents

g(s, w) g(w, s) (in gross model).

GRAPH DECOMPOSITION BASED ON DEGREE CONSTRAINTS. March 3, 2016

Network optimization: An overview

6. Lecture notes on matroid intersection

Lecture and notes by: Sarah Fletcher and Michael Xu November 3rd, Multicommodity Flow

implementing the breadth-first search algorithm implementing the depth-first search algorithm

Lecture 8: Non-bipartite Matching. Non-partite matching

Problem set 2. Problem 1. Problem 2. Problem 3. CS261, Winter Instructor: Ashish Goel.

A Faster Algorithm for the Inverse Spanning Tree Problem

by conservation of flow, hence the cancelation. Similarly, we have

Finite Termination of Augmenting Path Algorithms in the Presence of Irrational Problem Data

Problem Set 7 Solutions

Algorithm Circle Extra Lecture: Solving the Assignment Problem with Network Flow

Lecture 4: Primal Dual Matching Algorithm and Non-Bipartite Matching. 1 Primal/Dual Algorithm for weighted matchings in Bipartite Graphs

1 Matching in Non-Bipartite Graphs

y i = S i ΠS y i + S i ΠN\S

Minimum Spanning Tree (undirected graph)

Practice Final Exam 1

instead of waiting till hit sink to augment, augment a s a d v ance augment ( v w ) amount is min of ow r e a c hing v and (v w ) \unaugment" when ret

Chapter 7. Network Flow. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

8 Matroid Intersection

Sequential and parallel deficit scaling algorithms for minimum flow in bipartite networks

Assignment 4 Solutions of graph problems

Network Flow and Matching

6.854J / J Advanced Algorithms Fall 2008

Matchings in Graphs. Definition 1 Let G = (V, E) be a graph. M E is called as a matching of G if v V we have {e M : v is incident on e E} 1.

Network models and graph theory

AMS /672: Graph Theory Homework Problems - Week V. Problems to be handed in on Wednesday, March 2: 6, 8, 9, 11, 12.

Number Theory and Graph Theory

Discrete Optimization 2010 Lecture 5 Min-Cost Flows & Total Unimodularity

Assignment and Matching

Job Management & Network Flows

and 6.855J. The Successive Shortest Path Algorithm and the Capacity Scaling Algorithm for the Minimum Cost Flow Problem

Semi-Matchings for Bipartite Graphs and Load Balancing

Lecture 4. 1 Overview. 2 Preflows. COMPSCI 532: Design and Analysis of Algorithms September 4, 2015

COT 6936: Topics in Algorithms! Giri Narasimhan. ECS 254A / EC 2443; Phone: x3748

arxiv: v2 [cs.ds] 14 Sep 2010

Workshop In Advanced Data Structures Push-Relabel Heuristics. Maya Orshizer Sagi Hed

CS 125 Section #5 Graph Traversal and Linear Programs October 6, 2016

Reducing Directed Max Flow to Undirected Max Flow and Bipartite Matching

Bipartite Matching & the Hungarian Method

MAXIMAL FLOW THROUGH A NETWORK

Important separators and parameterized algorithms

MATH 350 GRAPH THEORY & COMBINATORICS. Contents

7. NETWORK FLOW III. assignment problem input-queued switching. Lecture slides by Kevin Wayne Copyright 2005 Pearson-Addison Wesley

Transcription:

Effective maximum flow algorithms Modeling with flows Network Design and Optimization course Lecture 5 Alberto Ceselli alberto.ceselli@unimi.it Dipartimento di Tecnologie dell Informazione Università degli Studi di Milano November 7, 0 A. Ceselli, DTI Univ. of Milan Network Design and Optimization course

Review of the Ford-Fulkerson Algorithm Begin x := 0; create the residual network G(x); while there is some directed path from s to t in G(x) do begin let P be a path from s to t in G(x); δ* := δ(p); send δ* units of flow along P; update the r's; end end {the flow x is now maximum}. 5

Effective maximum flow algorithms Modeling with flows Limits of Ford-Fulkerson Limits of Ford-Fulkerson Capacity scaling Shortest Augmenting Path algorithm Computational complexity of O(nmU); bad behaviour also on simple instances; may not converge to optimal solutions when data is irrational. A. Ceselli, DTI Univ. of Milan Network Design and Optimization course

Effective maximum flow algorithms Modeling with flows How to improve Ford-Fulkerson Limits of Ford-Fulkerson Capacity scaling Shortest Augmenting Path algorithm Some ways to improve them: augmenting in large increments of flow (capacity scaling algorithms), using a combinatorial strategy to choose augmenting paths (shortest augmenting path algorithms), relax flow conservation constraints in intermediate steps of the algorithm (preflow-push algorithms). Preflow-push yield O(nm + n log U) time complexity. A. Ceselli, DTI Univ. of Milan Network Design and Optimization course

Effective maximum flow algorithms Modeling with flows -Residual network Limits of Ford-Fulkerson Capacity scaling Shortest Augmenting Path algorithm Given a flow x and a parameter, let us define as -residual network G(x, ) the subgraph obtained from the residual network by removing arcs of residual capacity less than. A. Ceselli, DTI Univ. of Milan Network Design and Optimization course

Effective maximum flow algorithms Modeling with flows Capacity scaling algorithm Limits of Ford-Fulkerson Capacity scaling Shortest Augmenting Path algorithm BEGIN x := 0 := log U while do begin while G(x, ) contains a path from s to t do begin identify a path P in G(x, ) δ := min{r ij : (i, j) P} augment δ units of flow along P and update G(x, ) end := / end END A. Ceselli, DTI Univ. of Milan Network Design and Optimization course

Effective maximum flow algorithms Modeling with flows Complexity of capacity scaling Limits of Ford-Fulkerson Capacity scaling Shortest Augmenting Path algorithm We can prove that capacity scaling solves the maximum flow problem within O(m log U) augmentations, using O(m log U) time overall. A. Ceselli, DTI Univ. of Milan Network Design and Optimization course

Basic observations Effective maximum flow algorithms Modeling with flows Limits of Ford-Fulkerson Capacity scaling Shortest Augmenting Path algorithm Observation : := log U in the beginning, and halves at every iteration (scaling phase), at most log U scaling phases are performed. Observation : when == (i.e. during the last iteration) G(x, ) == G(x), capacity scaling outputs an optimal flow. A. Ceselli, DTI Univ. of Milan Network Design and Optimization course

More observations Effective maximum flow algorithms Modeling with flows Limits of Ford-Fulkerson Capacity scaling Shortest Augmenting Path algorithm Observation 3: capacity scaling performs at most m augmentations per scaling phase. Proof: Let x be the flow after scaling phase with =, and let v be its value, let S be the set of nodes reachable from s in G(x, ), A. Ceselli, DTI Univ. of Milan Network Design and Optimization course

More observations Effective maximum flow algorithms Modeling with flows Limits of Ford-Fulkerson Capacity scaling Shortest Augmenting Path algorithm Observation 3: capacity scaling performs at most m augmentations per scaling phase. Proof: Let x be the flow after scaling phase with =, and let v be its value, let S be the set of nodes reachable from s in G(x, ), then [S, S] forms an s-t cut A. Ceselli, DTI Univ. of Milan Network Design and Optimization course

More observations Effective maximum flow algorithms Modeling with flows Limits of Ford-Fulkerson Capacity scaling Shortest Augmenting Path algorithm Observation 3: capacity scaling performs at most m augmentations per scaling phase. Proof: Let x be the flow after scaling phase with =, and let v be its value, let S be the set of nodes reachable from s in G(x, ), then [S, S] forms an s-t cut the residual capacity of each arc in the cut is <, A. Ceselli, DTI Univ. of Milan Network Design and Optimization course

More observations Effective maximum flow algorithms Modeling with flows Limits of Ford-Fulkerson Capacity scaling Shortest Augmenting Path algorithm Observation 3: capacity scaling performs at most m augmentations per scaling phase. Proof: Let x be the flow after scaling phase with =, and let v be its value, let S be the set of nodes reachable from s in G(x, ), then [S, S] forms an s-t cut the residual capacity of each arc in the cut is <, the residual capacity of the cut is m A. Ceselli, DTI Univ. of Milan Network Design and Optimization course

More observations Effective maximum flow algorithms Modeling with flows Limits of Ford-Fulkerson Capacity scaling Shortest Augmenting Path algorithm Observation 3: capacity scaling performs at most m augmentations per scaling phase. Proof: Let x be the flow after scaling phase with =, and let v be its value, let S be the set of nodes reachable from s in G(x, ), then [S, S] forms an s-t cut the residual capacity of each arc in the cut is <, the residual capacity of the cut is m v v + m (weak duality) A. Ceselli, DTI Univ. of Milan Network Design and Optimization course

More observations Effective maximum flow algorithms Modeling with flows Limits of Ford-Fulkerson Capacity scaling Shortest Augmenting Path algorithm Observation 3: capacity scaling performs at most m augmentations per scaling phase. Proof: Let x be the flow after scaling phase with =, and let v be its value, let S be the set of nodes reachable from s in G(x, ), then [S, S] forms an s-t cut the residual capacity of each arc in the cut is <, the residual capacity of the cut is m v v + m (weak duality) at most m units of flow remain to be carried in the next scaling phases. A. Ceselli, DTI Univ. of Milan Network Design and Optimization course

More observations Effective maximum flow algorithms Modeling with flows Limits of Ford-Fulkerson Capacity scaling Shortest Augmenting Path algorithm Observation 3: capacity scaling performs at most m augmentations per scaling phase. Proof: Let x be the flow after scaling phase with =, and let v be its value, let S be the set of nodes reachable from s in G(x, ), then [S, S] forms an s-t cut the residual capacity of each arc in the cut is <, the residual capacity of the cut is m v v + m (weak duality) at most m units of flow remain to be carried in the next scaling phases. each augmentation in the next scaling phase carries at least / units of flow A. Ceselli, DTI Univ. of Milan Network Design and Optimization course

More observations Effective maximum flow algorithms Modeling with flows Limits of Ford-Fulkerson Capacity scaling Shortest Augmenting Path algorithm Observation 3: capacity scaling performs at most m augmentations per scaling phase. Proof: Let x be the flow after scaling phase with =, and let v be its value, let S be the set of nodes reachable from s in G(x, ), then [S, S] forms an s-t cut the residual capacity of each arc in the cut is <, the residual capacity of the cut is m v v + m (weak duality) at most m units of flow remain to be carried in the next scaling phases. each augmentation in the next scaling phase carries at least / units of flow at most m augmentations can be performed A. Ceselli, DTI Univ. of Milan Network Design and Optimization course

More observations Effective maximum flow algorithms Modeling with flows Limits of Ford-Fulkerson Capacity scaling Shortest Augmenting Path algorithm Observation 4: each scaling phase requires at most O(m) time O(m) time to find an augmenting path (depth first search), O(m) time to update the residual network. So, overall m log U iterations, each of cost O(m) O(m log U ). A. Ceselli, DTI Univ. of Milan Network Design and Optimization course

Effective maximum flow algorithms Modeling with flows Shortest augmenting path algorithm Limits of Ford-Fulkerson Capacity scaling Shortest Augmenting Path algorithm See Orlin s slides (cut and paste ahead!) A. Ceselli, DTI Univ. of Milan Network Design and Optimization course

The Shortest Augmenting Path Algorithm Overview: We will establish the following: We can determine each augmentation in O(n) time if we maintain "distance labels" and can carry out the augmentation in O(n) time. The total time to maintain and update all distance labels is O(nm). The total number of augmentations is O(nm). Conclusion. The total running time is O(n m). 7

Distance Labels A distance label is a function d: N Z +. A distance label is said to be valid if it satisfies the following: d(t) = 0. d(i) d(j) + for each (i,j) G(x). An arc (i,j) G(x) is admissible if d(i) =d(j) +. 8

An example of valid distance labels The distance labels are on the nodes. 3 5 All arcs are in the residual network. s 3 4 4 t0 t The admissible arcs are thick and red. 3 The labels would not be valid if there were an arc from to 0. 9

More on valid distance labels Lemma. Let d( ) be a valid distance label. Then d(i) is a lower bound on the distance from i to t in the residual network. (The distance is measured in terms of the number of arcs.) Proof. Let P be any path from i to t in G(x) with k arcs. We claim to show that d(i) k. Assume the claim is true for paths of k- or fewer arcs. k i k- j 0 t P has k arcs P has k- arcs 0

On Finding Paths shortest s-t paths Lemma. If there is an admissible path P from s to t, then it is a shortest path. Proof. The length of the path is d(s) which is at most the length of the shortest path. 4 3 0 s t

The shortest augmenting path algorithm begin while d(s) < n do begin if there is a node with d(i) d(s) and no admissible arcs from j then Relabel(i) else find an admissible path from s to t and augment flow along the path end end Procedure Relabel(i) begin if there are no admissible arcs coming out of node i, then d(i) := + min ( d(j) : r ij > 0}; if d(s) > n-, then quit; end Shortest augmenting path animation

Comments on the run time analysis Bound the relabels, and the time for relabels O(n ) relabels, O(nm) time. Bound the number of augmentations, and the time to carry out the augmentations O(nm) augmentations O(n m) arcs in augmentations O(n m) time. Bound the time spent looking for augmentations. O(n m) time spent identifying the arcs in augmentations. 3

Bounding the number of relabels. Claim: after a relabel of node i, the distances are still valid, and the distance label of node i strictly increased. Claim: Once d(i) > n-, there is no path from node i to the sink node t, and so one can ignore node i subsequently. Conclusion: There can be at most n relabels of node i, and at most n relabels in total. 4

Bounding the time for relabels Tail Head Res. Admissible Cap? 4 0 No 4 No 4 3 4 No Maintain a current arc for each adjacency list. 4 5 0 No Scan through A(4). 4 6 0 No d(3) := 4 3 4 3 3 4 Each arc in A(4) is scanned once per relabel, at most n times over all relabels. Total time for relabels: 6 5 O(nm). 5

Bounding the Number of Augmentations If an augmentation uses up the residual capacity of an arc, then the arc is said to be saturated. At least one arc is saturated at each augmentation. If arc (i,j) is saturated, then it is not admissible until flow is sent from j to i, and this cannot happen until d(j) increases. (see next slide) Conclusion: each arc is saturated at most n times. Corollary. There are O(nm) augmentations. The number of arcs in these augmentations is O(n m). 6

(,) is saturated in the augmentation s 3 3 3 3 4 5 4 t0 After the saturation, arc (,) is deleted from G(x). It doesn t get added until there is flow in (,) But for that, the distance label must increase from to 3. And to send flow back, the distance label must increase from to 4. 7

Time spent looking for augmentations We need to find admissible arcs, and know when they do not exist. s 3 3 4 5 4 t0 Start with s and do a depth first search using admissible arcs. If there are no admissible arcs from i, then relabel(i) and reverse along the path leading to i. 8

Bounding number of arcs in paths Each arc added to a path either ends up being reversed or ends up in an augmentation. O(n m) arcs in augmentation O(n ) arcs in reversals, since a reversal immediately follows a relabel. O(n m) arcs added to paths in total. 9

Last step: finding admissible arcs 3 4 Tail Head Res. Admissible Cap? 4 0 No 4 No 4 3 4 No 4 5 Yes 4 6 0 No 3 6 5 3 4 Scan arcs in A(4) looking for an admissible arc. key observation: if (4, j) is not admissible, it cannot be admissible again until after node 4 is relabeled. So, current arc is moved at most A(4) times between relabels of node 4. 30

Network reliability Effective maximum flow algorithms Modeling with flows Network reliability Resource assignment Given a network and two clients of this network what is the number of link-disjoint paths between these two clients? how can we find them? A. Ceselli, DTI Univ. of Milan Network Design and Optimization course

Network Reliability Communication Network What is the maximum number of arc disjoint paths from s to t? How can we determine this number? Theorem. Let G = (N,A) be a directed graph. Then the maximum number of arc-disjoint paths from s to t is equal to the minimum number of arcs upon whose deletion there is no directed s-t path. s t

There are 3 arc-disjoint s-t paths 5 9 6 0 s t 3 7 4 8 3

Deleting 3 arcs disconnects s and t 5 9 6 0 s t 3 7 4 8 Let S = {s, 3, 4, 8}. The only arcs from S to T = N\S are the 3 deleted arcs. 4

Network reliability Effective maximum flow algorithms Modeling with flows Network reliability Resource assignment Given a network and two clients of this network what is the number of node-disjoint paths between these two clients? how can we find them? A. Ceselli, DTI Univ. of Milan Network Design and Optimization course

Effective maximum flow algorithms Modeling with flows Maximum matching Network reliability Resource assignment Given a set of computers and a set of tasks, for each computer, the subset of tasks that can be performed on it each computer can perform at most task at a time each task can be performed at most by computer at a time find the allocation of tasks to computers that maximizes the number of tasks performed. A. Ceselli, DTI Univ. of Milan Network Design and Optimization course

Matchings An undirected network G = (N, A) is bipartite if N can be partitioned into N and N so that for every arc (i,j) either i N and j N. A matching in N is a set of arcs no two of which are incident to a common node. 3 4 6 7 8 9 Matching Problem: Find a matching of maximum cardinality 5 0 8

Transformation to a Max Flow Problem 6 7 s 3 8 t 4 9 5 0 Each arc (s, i) has a capacity of. Each arc (j, t) has a capacity of. Replace original arcs by pairs, and put infinite capacity on original arcs. 9

Find a max flow 6 7 s 3 8 t 4 9 5 0 The maximum s-t flow is 4. The max matching has cardinality 4. 0

Effective maximum flow algorithms Modeling with flows Network surveillance Network reliability Resource assignment Given two networks a set of links connecting them install surveillance software on some computers to check connection links so that each link is under surveillance and the number of software licenses is minimized A. Ceselli, DTI Univ. of Milan Network Design and Optimization course

Determine the minimum cut 6 7 s 3 8 t 4 9 5 0 S = {s,, 3, 4, 6, 8}. T = {, 5, 7, 9, 0, t}. There is no arc from {, 3, 4} to {7, 9, 0} or from {6, 8} to {, 5}. Any such arc would have an infinite capacity.

Interpret the minimum cut 6 7 s 3 8 t 4 9 5 0 Look at the original nodes incident to the minimum cut. Every original arc is incident to one of them.

Matching Duality 6 7 3 8 4 9 Such a collection of nodes is called a node cover 5 0 The maximum cardinality of a matching is the minimum number of nodes that covers all of the arcs. 3