1 The Min Cost Flow Problem. 2 Flow Networks with Costs Flow networks with costs are the problem instances of the min cost flow problem. A flow network.

Slides:



Advertisements
Similar presentations
Lecture 7. Network Flows We consider a network with directed edges. Every edge has a capacity. If there is an edge from i to j, there is an edge from.
Advertisements

Linear Programming (LP) (Chap.29)
Introduction to Algorithms
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
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.
Introduction To Algorithms CS 445 Discussion Session 8 Instructor: Dr Alon Efrat TA : Pooja Vaswani 04/04/2005.
MAXIMUM FLOW Max-Flow Min-Cut Theorem (Ford Fukerson’s Algorithm)
The Maximum Network Flow Problem. CSE Network Flows.
Advanced Algorithm Design and Analysis (Lecture 8) SW5 fall 2004 Simonas Šaltenis E1-215b
Lectures on Network Flows
1 The Max Flow Problem. 2 Flow networks Flow networks are the problem instances of the max flow problem. A flow network is given by 1) a directed graph.
CS138A Network Flows Peter Schröder. CS138A Flow Networks Definitions a flow network G=(V,E) is a directed graph in which each edge (u,v)
1 Generality of Languages Maximum Cardinality Matching Max (s,t)-Flow Min Cost Flow Hopcroft-Karp Linear Programs Reduction Edmonds-Karp Klein’s algorithm.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Spring, 2001 Lecture 4 Tuesday, 2/19/02 Graph Algorithms: Part 2 Network.
1 Maximum flow problems. 2 - Introduction of: network, max-flow problem capacity, flow - Ford-Fulkerson method pseudo code, residual networks, augmenting.
1 Maximum Flow Maximum Flow Problem The Ford-Fulkerson method Maximum bipartite matching.
1 Optimization Spring 2007 (Third Quarter). 2 Some practical remarks Homepage: Exam: Written, 3 hours. There.
Network Optimization Models: Maximum Flow Problems In this handout: The problem statement Solving by linear programming Augmenting path algorithm.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2001 Lecture 4 Tuesday, 10/2/01 Graph Algorithms: Part 2 Network.
The max flow problem
Yangjun Chen 1 Network Flow What is a network? Flow network and flows Ford-Fulkerson method - Residual networks - Augmenting paths - Cuts of flow networks.
Flows sourcesink s t Flows sourcesink edge-weights = capacities.
Maximum flow Algorithms and Networks. A&N: Maximum flow2 Today Maximum flow problem Variants Applications Briefly: Ford-Fulkerson; min cut max flow theorem.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2004 Lecture 5 Wednesday, 10/6/04 Graph Algorithms: Part 2.
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.
Maximum Flow Maximum Flow Problem The Ford-Fulkerson method
1 The Min Cost Flow Problem. 2 The Min Cost Flow problem We want to talk about multi-source, multi-sink flows than just “flows from s to t”. We want to.
Maximum Flow Chapter 26.
CS774. Markov Random Field : Theory and Application Lecture 13 Kyomin Jung KAIST Oct
Yangjun Chen 1 Network Flow What is a network? Flow network and flows Ford-Fulkerson method - Residual networks - Augmenting paths - Cuts of flow networks.
Single Source Shortest-Path: The General Case (with negative edges) Bellman-Ford algorithm. Iteratively relax all edges |V|-1 times Running time? O(VE).
The minimum cost flow problem. Simplifying assumptions Network is connected (as an undirected graph). – We can consider each connected component separately.
CS 473Lecture ?1 CS473-Algorithms I Lecture ? Network Flows Finding Max Flow.
Max Flow – Min Cut Problem. Directed Graph Applications Shortest Path Problem (Shortest path from one point to another) Max Flow problems (Maximum material.
Maximum Flow Problem (Thanks to Jim Orlin & MIT OCW)
Maximum Flow Chapter 26. Flow Concepts Source vertex s – where material is produced Sink vertex t – where material is consumed For all other vertices.
15.082J & 6.855J & ESD.78J October 7, 2010 Introduction to Maximum Flows.
15.082J and 6.855J March 4, 2003 Introduction to Maximum Flows.
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.
Data Structures & Algorithms Network Flow Richard Newman based on book by R. Sedgewick.
Exercise 6.1 Find the number of different shortest paths from point A to point B in a city with perfectly horizontal streets and vertical avenues as shown.
Flow Networks Ching-Chen Huang Hsi-Yue Hsiao. CONTENTS Network flows on directed acyclic graphs Ford-fulkerson Algorithms -Residual networks.
Theory of Computing Lecture 12 MAS 714 Hartmut Klauck.
TU/e Algorithms (2IL15) – Lecture 12 1 Linear Programming.
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.
Instructor Neelima Gupta Edited by Divya Gaur(39, MCS '09) Thanks to: Bhavya(9), Deepika(10), Deepika Bisht(11) (MCS '09)
TU/e Algorithms (2IL15) – Lecture 12 1 Linear Programming.
The Maximum Network Flow Problem
Minimum Cost Flow Algorithms and Networks. Algorithms and Networks: Minimum Cost Flow2 This lecture The minimum cost flow problem: statement and applications.
TU/e Algorithms (2IL15) – Lecture 8 1 MAXIMUM FLOW (part II)
Maximum Flow Chapter 26.
Data Structures and Algorithms (AT70. 02) Comp. Sc. and Inf. Mgmt
The assignment problem
Lectures on Network Flows
Algorithms and Networks Hans Bodlaender
Network flow problem [Adapted from M.Chandy].
Algorithms and Networks
Lecture 22 Network Flow, Part 2
Network Flow 2016/04/12.
Instructor: Shengyu Zhang
Analysis of Algorithms
Flow Networks Topics Flow Networks Residual networks
Flow Networks and Bipartite Matching
Algorithms (2IL15) – Lecture 7
EE5900 Advanced Embedded System For Smart Infrastructure
Algorithms and Networks
Lecture 22 Network Flow, Part 2
Presentation transcript:

1 The Min Cost Flow Problem

2 Flow Networks with Costs Flow networks with costs are the problem instances of the min cost flow problem. A flow network with costs is given by 1) a directed graph G = (V,E) 2) capacities c: E ! R. 3) balances b: V ! R. 4) costs k: V £ V ! R. k(u,v) = -k(v,u). Convention: c(u,v)=0 for (u,v) not in E.

3 Feasible Flows Given a flow network with costs, a feasible flow is a feasible solution to the min cost flow problem. A feasible flow is a map f: V £ V ! R satisfying capacity constraints: 8 (u,v): f(u,v) · c(u,v). Skew symmetry: 8 (u,v): f(u,v) = – f(v,u). Balance Constraints: 8 u 2 V:  v 2 V f(u,v) =b(u)

4 Cost of Feasible Flows The cost of a feasible flow f is cost(f) = ½  (u,v) 2 V £ V k(u,v) f(u,v) The Min Cost Flow Problem: Given a flow network with costs, find the feasible flow f that minimizes cost(f).

5 Min cost flow model of Ahuja Ahuja operates with non-reduced flows, we work with reduced flows (net flows). They do not require flows and costs to be skew-symmetric.

6 Unreduced vs net flows Unreduced flow Net flow

7 Min cost flow model of Ahuja Ahuja operates with non-reduced flows, we work with reduced flows (net flows). They do not require flows and costs to be skew symmetric. The only time where our model is different from theirs is when one cannot be sure in which direction along a given edge the net flow will be. One can translate (reduce) the Ahuja version to our version (exercise).

8 Tanker Scheduling Problem

9 Capacity 1, Lower Bound 1, Cost 0 Capacity 1, Cost 0 Capacity 4, Cost 1 All balances 0 Capacity 1, Cost 0

10 Hopping Airplane Problem An airplane must travel from city 1, to city 2, to city 3,.., to city n. At most p passengers can be carried at any time. b ij passengers want to go from city i to city j and will pay f ij for the trip. How many passengers should be picked up at each city in order to maximize profits?

11

12 Local Search Pattern LocalSearch(ProblemInstance x) y := feasible solution to x; while 9 z ∊ N(y): v(z)<v(y) do y := z; od; return y; N(y) is a neighborhood of y.

13 Local search checklist Design: How do we find the first feasible solution? Neighborhood design? Which neighbor to choose? Analysis: Partial correctness? (termination ) correctness) Termination? Complexity?

14 The first feasible flow? Because of negative capacities and balance constraints, finding the first flow is non-trivial. The zero flow may not work and there may not be any feasible flow for a given instance. We can find the first feasible flow, if one exists, by reducing this problem to a max flow problem.

15 Neighborhood design Given a feasible flow, how can we find a slightly different (and hopefully slightly better) flow?

16 The residual network Let G=(V,E,c,b,k) be a flow network with costs and let f be a flow in G. The residual network G f is the flow network with costs inherited from G and edges, capacities and balances given by: E f = {(u,v) 2 V £ V| f(u,v) < c(u,v)} c f (u,v) = c(u,v) - f(u,v) ¸ 0 b f (u)=0

17 Lemma 3 Let G=(V,E,c,b,k) be a flow network with costs f be a feasible flow in G G f be the residual network f’ be a feasible flow in G f Then f+f’ is a feasible flow in G with cost(f+f’)=cost(f)+cost(f’)

18 Lemma 4 Let G=(V,E,c,b,k) be a flow network with costs f be a feasible flow in G f’ be a feasible flow in G Then f’-f is a feasible flow in G f

19 Cycle Flows Let C = (u 1 ! u 2 ! u 3 … ! u k =u 1 ) be a simple cycle in G. The cycle flow  C  is the circulation defined by  C  (u i, u i+1 ) =   C  (u i+1, u i ) = -   C  (u,v) = 0 otherwise.

20 Capacity 29, Cost -1 All other costs 0, all balances 0. Capacity 29, Cost 0

21 Augmenting cycles Let G be a flow network with costs and G f the residual network. An augmenting cycle C=(u 1, u 2, …, u r = u 1 ) is a simple cycle in G f for which cost(  C  )<0 where  is the minimum capacity c f (u i, u i+1 ), i = 1…r-1

22 Klein’s algorithm for min cost flow MinCostFlow(G) Using max flow algorithm, find feasible flow f in G (if no such flow exist, abort). while( 9 augmenting cycle C in G f ){  = min{c f (e) | e on C} f := f +  C  } output f

23 Klein’s algorithm If Klein’s algorithm terminates it produces a feasible flow in G (by Lemma 3). Is it partially correct? Does it terminate?

24 Circulation Decomposition Lemma Let G be a circulation network with no negative capacities. Let f be a feasible circulation in G. Then, f may be written as a sum of cycle flows: f =  C 1  1 +  C 2  2 + … +  C m  m where each cycle flow is a feasible circulation in G.

25 CDL ) Partial Correctness of Klein Suppose f is not an minimum cost flow in G. We should show that G f has an augmenting cycle. Let f * be a minimum cost flow in G. f * - f is a feasible circulation in G f of strictly negative cost (Lemma 4). f * - f is a sum of cycle flows, feasible in G f (by CDL). At least one of them must have strictly negative cost. The corresponding cycle is an augmenting cycle.

26 Termination Assume integer capacities and balances. For any feasible flow f occuring in Klein’s algorithm and any u,v, the flow f(u,v) is an integer between –c(v,u) and c(u,v). Thus there are only finitely many possibilities for f. In each iteration, f is improved – thus we never see an old f again. Hence we terminate.

27 Integrality theorem for min cost flow If a flow network with costs has capacities and balances integer valued and a feasible flow in the network exists, then there is a minimum cost feasible flow which is integer valued. Proof by “type checking” Klein’s algorithm

28 Complexity How fast can we perform a single iteration of the local search? How many iterations do we have?

29 Complexity of a single iteration An iteration is dominated by finding an augmenting cycle. An augmenting cycle is a cycle (u 1, u 2, … u r =u 1 ) in G f with  i k(u i,u i+1 ) < 0 How to find one efficiently? Exercise 7.

30 Number of iterations As Ford-Fulkerson, Klein’s algorithm may use an exponential number of iterations, if care is not taken choosing the augumentation (Exercise 6). Fact: If the cycle with minimum average edge cost is chosen, there can be at most O(|E| 2 |V| log |V|) iterations.

31 Generality of Languages Maximum Cardinality Matching Max (s,t)-Flow Min Cost Flow Hopcroft-Karp (dADS) Linear Programs Reduction Edmonds-Karp Klein’s algorithm Simplex Algorithm, Interior Point Algorithms Algorithm Increasing generality Decreasing efficiency Algorithm