10/11/10 A. Smith; based on slides by E. Demaine, C. Leiserson, S. Raskhodnikova, K. Wayne Adam Smith Algorithm Design and Analysis L ECTURE 22 Network.

Slides:



Advertisements
Similar presentations
Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: uij is the capacity on arc (i,j). Find non-negative flow fij for.
Advertisements

Introduction to Algorithms
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
1 Maximum flow sender receiver Capacity constraint Lecture 6: Jan 25.
Chapter 6 Maximum Flow Problems Flows and Cuts Augmenting Path Algorithm.
MS&E 211 Minimum Cost Flow LP Ashish Goel. Minimum Cost Flow (MCF) Need to ship some good from “supply” nodes to “demand” nodes over a network – Example:
Basic Feasible Solutions: Recap MS&E 211. WILL FOLLOW A CELEBRATED INTELLECTUAL TEACHING TRADITION.
COMP 482: Design and Analysis of Algorithms
Foreground/Background Image Segmentation. What is our goal? To label each pixel in an image as belonging to either the foreground of the scene or the.
Piyush Kumar (Lecture 6: MaxFlow MinCut Applications)
MAXIMUM FLOW Max-Flow Min-Cut Theorem (Ford Fukerson’s Algorithm)
Prof. Swarat Chaudhuri COMP 482: Design and Analysis of Algorithms Spring 2012 Lecture 19.
1 Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
1 Maximum Flow Networks Suppose G = (V, E) is a directed network. Each edge (i,j) in E has an associated ‘capacity’ u ij. Goal: Determine the maximum amount.
1 Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Optimal solution of binary problems Much material taken from :  Olga Veksler, University of Western Ontario
7.7 Extensions to Max Flow. 2 Circulation with Demands Circulation with demands. n Directed graph G = (V, E). n Edge capacities c(e), e  E. n Node supply.
Network Optimization Models: Maximum Flow Problems In this handout: The problem statement Solving by linear programming Augmenting path algorithm.
MRF Labeling With Graph Cut CMPUT 615 Nilanjan Ray.
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.
Maximum Flow Applications
Applications of Network Flow Problem. 7.5 Bipartite Matching.
Branch and Bound Algorithm for Solving Integer Linear Programming
1 Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
CSE 421 Algorithms Richard Anderson Lecture 24 Network Flow Applications.
CSEP 521 Applied Algorithms
Max-flow/min-cut theorem Theorem: For each network with one source and one sink, the maximum flow from the source to the destination is equal to the minimal.
15.082J, 6.855J, and ESD.78J September 21, 2010 Eulerian Walks Flow Decomposition and Transformations.
1 Linear Programming & Flows Instructor: YE, Deshi
Introduction to Operations Research
Section 2.9 Maximum Flow Problems Minimum Cost Network Flows Shortest Path Problems.
Advanced Algorithms Piyush Kumar (Lecture 4: MaxFlow MinCut Applications) Welcome to COT5405.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 26.
CS774. Markov Random Field : Theory and Application Lecture 13 Kyomin Jung KAIST Oct
1 Minimum Cost Flows Goal: Minimize costs to meet all demands in a network subject to capacities (combines elements of both shortest path and max flow.
Chapter 7 Transportation, Assignment & Transshipment Problems
1 Linear Programming & Flows Instructor: yedeshi
CSE 421 Algorithms Richard Anderson Lecture 24 Network Flow Applications.
Applications of the Max-Flow Min-Cut Theorem. S-T Cuts SF D H C A NY S = {SF, D, H}, T={C,A,NY} [S,T] = {(D,A),(D,C),(H,A)}, Cap [S,T] =
Graph Cuts Marc Niethammer. Segmentation by Graph-Cuts A way to compute solutions to the optimization problems we looked at before. Example: Binary Segmentation.
Network Flow. Network flow formulation A network G = (V, E). Capacity c(u, v)  0 for edge (u, v). Assume c(u, v) = 0 if (u, v)  E. Source s and sink.
Maximum Flow Problem (Thanks to Jim Orlin & MIT OCW)
CS 361 – Chapter 16 Final thoughts on minimum spanning trees and similar problems Flow networks Commitment: –Decide on presentation order.
Chapter 7 April 28 Network Flow.
15.082J and 6.855J March 4, 2003 Introduction to Maximum Flows.
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.
1 Chapter 2 Notation and Definitions Data Structures Transformations.
Prof. Swarat Chaudhuri COMP 382: Reasoning about Algorithms Fall 2015.
1 Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
CSE 421 Algorithms Richard Anderson Lecture 24 Network Flow Applications.
Markov Random Fields in Vision
1 Maximum Flows CONTENTS Introduction to Maximum Flows (Section 6.1) Introduction to Minimum Cuts (Section 6.1) Applications of Maximum Flows (Section.
Tuesday, March 19 The Network Simplex Method for Solving the Minimum Cost Flow Problem Handouts: Lecture Notes Warning: there is a lot to the network.
Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
The minimum cost flow problem
Algorithm Design and Analysis
3.3 Applications of Maximum Flow and Minimum Cut
Network Flow 2016/04/12.
Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Network Flow and Connectivity in Wireless Sensor Networks
Richard Anderson Lecture 24 Network Flow Applications
Introduction to Maximum Flows
Introduction Basic formulations Applications
Max Flow Min Cut, Bipartite Matching Yin Tat Lee
Piyush Kumar (Lecture 6: MaxFlow MinCut Applications)
EE5900 Advanced Embedded System For Smart Infrastructure
Flow Feasibility Problems
Maximum Flow Problems in 2005.
Presentation transcript:

10/11/10 A. Smith; based on slides by E. Demaine, C. Leiserson, S. Raskhodnikova, K. Wayne Adam Smith Algorithm Design and Analysis L ECTURE 22 Network Flow Applications

Extensions/applications Partition problems –Think of minimum cut Circulations (in KT book) 10/11/10 A. Smith; based on slides by E. Demaine, C. Leiserson, S. Raskhodnikova, K. Wayne

7.10 Image Segmentation

4 Image Segmentation Image segmentation. n Central problem in image processing. n Divide image into coherent regions. Ex: Three people standing in front of complex background scene. Identify each person as a coherent object.

5 Image Segmentation Foreground / background segmentation. n Label each pixel in picture as belonging to foreground or background. n V = set of pixels, E = pairs of neighboring pixels. n a i  0 is likelihood pixel i in foreground. n b i  0 is likelihood pixel i in background. n p ij  0 is separation penalty for labeling one of i and j as foreground, and the other as background. Goals. n Accuracy: if a i > b i in isolation, prefer to label i in foreground. n Smoothness: if many neighbors of i are labeled foreground, we should be inclined to label i as foreground. n Find partition (A, B) that maximizes: foreground background

6 Image Segmentation Formulate as min cut problem. n Maximization. n No source or sink. n Undirected graph. Turn into minimization problem. n Maximizing is equivalent to minimizing n or alternatively

7 Image Segmentation Formulate as min cut problem. n G' = (V', E'). n Add source to correspond to foreground; add sink to correspond to background n Use two anti-parallel edges instead of undirected edge. st p ij ij ajaj G' bibi

8 Image Segmentation Consider min cut (A, B) in G'. n A = foreground. n Precisely the quantity we want to minimize. G' st ij A if i and j on different sides, p ij counted exactly once p ij bibi ajaj

7.11 Project Selection

10 Project Selection Projects with prerequisites. n Set P of possible projects. Project v has associated revenue p v. – some projects generate money: create interactive e-commerce interface, redesign web page – others cost money: upgrade computers, get site license n Set of prerequisites E. If (v, w)  E, can't do project v and unless also do project w. n A subset of projects A  P is feasible if the prerequisite of every project in A also belongs to A. Project selection. Choose a feasible subset of projects to maximize revenue. can be positive or negative

11 Project Selection: Prerequisite Graph Prerequisite graph. n Include an edge from v to w if can't do v without also doing w. n {v, w, x} is feasible subset of projects. n {v, x} is infeasible subset of projects. v w x v w x feasibleinfeasible

12 Min cut formulation. n Assign capacity  to all prerequisite edge. n Add edge (s, v) with capacity -p v if p v > 0. n Add edge (v, t) with capacity -p v if p v < 0. n For notational convenience, define p s = p t = 0. st -p w u v w x yz Project Selection: Min Cut Formulation  pvpv -p x      pypy pupu -p z 

13 Claim. (A, B) is min cut iff A  { s } is optimal set of projects. n Infinite capacity edges ensure A  { s } is feasible. n Max revenue because: s t -p w u v w x yz Project Selection: Min Cut Formulation pvpv -p x pypy pupu    A

14 Open-pit mining. (studied since early 1960s) n Blocks of earth are extracted from surface to retrieve ore. n Each block v has net value p v = value of ore - processing cost. n Can't remove block v before w or x. Open Pit Mining v xw

7.7 Circulations

16 Circulation with Demands Circulation with demands. n Directed graph G = (V, E). n Edge capacities c(e), e  E. n Node supply and demands d(v), v  V. Def. A circulation is a function that satisfies: n For each e  E:0  f(e)  c(e) (capacity) n For each v  V: (conservation) Circulation problem: given (V, E, c, d), does there exist a circulation? demand if d(v) > 0; supply if d(v) < 0; transshipment if d(v) = 0

17 Necessary condition: sum of supplies = sum of demands. Pf. Sum conservation constraints for every demand node v flow Circulation with Demands capacity demand supply

18 Circulation with Demands Max flow formulation. G: supply demand

19 Circulation with Demands Max flow formulation. n Add new source s and sink t. n For each v with d(v) < 0, add edge (s, v) with capacity -d(v). n For each v with d(v) > 0, add edge (v, t) with capacity d(v). n Claim: G has circulation iff G' has max flow of value D. G': supply s t saturates all edges leaving s and entering t demand

20 Circulation with Demands Integrality theorem. If all capacities and demands are integers, and there exists a circulation, then there exists one that is integer-valued. Pf. Follows from max flow formulation and integrality theorem for max flow. Characterization. Given (V, E, c, d), there does not exists a circulation iff there exists a node partition (A, B) such that  v  B d v > cap(A, B) Pf idea. Look at min cut in G'. demand by nodes in B exceeds supply of nodes in B plus max capacity of edges going from A to B

21 Circulation with Demands and Lower Bounds Feasible circulation. n Directed graph G = (V, E). n Edge capacities c(e) and lower bounds (e), e  E. n Node supply and demands d(v), v  V. Def. A circulation is a function that satisfies: n For each e  E: (e)  f(e)  c(e) (capacity) n For each v  V: (conservation) Circulation problem with lower bounds. Given (V, E,, c, d), does there exists a a circulation?

22 Circulation with Demands and Lower Bounds Idea. Model lower bounds with demands. n Send (e) units of flow along edge e. n Update demands of both endpoints. Theorem. There exists a circulation in G iff there exists a circulation in G'. If all demands, capacities, and lower bounds in G are integers, then there is a circulation in G that is integer-valued. Pf sketch. f(e) is a circulation in G iff f'(e) = f(e) - (e) is a circulation in G'. vw [2, 9] lower bound upper bound vw d(v)d(w) d(v) + 2 d(w) - 2 G G' 7 capacity

23 Census Tabulation (Exercise 7.39) Feasible matrix rounding. n Given a p-by-q matrix D = {d ij } of real numbers. n Row i sum = a i, column j sum b j. n Round each d ij, a i, b j up or down to integer so that sum of rounded elements in each row (column) equals row (column) sum. n Original application: publishing US Census data. Goal. Find a feasible rounding, if one exists original matrix feasible rounding

24 Census Tabulation Feasible matrix rounding. n Given a p-by-q matrix D = {d ij } of real numbers. n Row i sum = a i, column j sum b j. n Round each d ij, a i, b j up or down to integer so that sum of rounded elements in each row (column) equals row (column) sum. n Original application: publishing US Census data. Goal. Find a feasible rounding, if one exists. Remark. "Threshold rounding" can fail original matrix feasible rounding

25 Census Tabulation Theorem. Feasible matrix rounding always exists. Pf. Formulate as a circulation problem with lower bounds. n Original data provides circulation (all demands = 0). n Integrality theorem  integral solution  feasible rounding. ▪ s ' 2' 3' t row column 17, 18 12, 13 11, 12 16, 17 10, 11 14, 15 3, 4 0,  lower bound upper bound