Minimum Cost Flow Algorithms and Networks. Algorithms and Networks: Minimum Cost Flow2 This lecture The minimum cost flow problem: statement and applications.

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

Introduction to Algorithms
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
1 Maximum flow sender receiver Capacity constraint Lecture 6: Jan 25.
Algorithms and Networks
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:
Introduction To Algorithms CS 445 Discussion Session 8 Instructor: Dr Alon Efrat TA : Pooja Vaswani 04/04/2005.
Network Optimization Models: Maximum Flow Problems
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.
The Maximum Network Flow Problem. CSE Network Flows.
1 Maximum Flow w s v u t z 3/33/3 1/91/9 1/11/1 3/33/3 4/74/7 4/64/6 3/53/5 1/11/1 3/53/5 2/22/2 
1 Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Advanced Algorithm Design and Analysis (Lecture 8) SW5 fall 2004 Simonas Šaltenis E1-215b
Lectures on Network Flows
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.
Network Optimization Models: Maximum Flow Problems In this handout: The problem statement Solving by linear programming Augmenting path algorithm.
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.
Minimum Cost Flow Lecture 5: Jan 25. Problems Recap Bipartite matchings General matchings Maximum flows Stable matchings Shortest paths Minimum spanning.
Maximum flow Algorithms and Networks. A&N: Maximum flow2 Today Maximum flow problem Variants Applications Briefly: Ford-Fulkerson; min cut max flow theorem.
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.
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.
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.
Theory of Computing Lecture 13 MAS 714 Hartmut Klauck.
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.
1 COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf.
CS 4407, Algorithms University College Cork, Gregory M. Provan Network Optimization Models: Maximum Flow Problems In this handout: The problem statement.
Flows in Planar Graphs Hadi Mahzarnia. Outline O Introduction O Planar single commodity flow O Multicommodity flows for C 1 O Feasibility O Algorithm.
Maximum Flow. p2. Maximum Flow A flow network G=(V, E) is a DIRECTED graph where each has a nonnegative capacity u.
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.
Chapter 7 April 28 Network Flow.
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.
Matching Algorithms and Networks. Algorithms and Networks: Matching2 This lecture Matching: problem statement and applications Bipartite matching Matching.
and 6.855J March 6, 2003 Maximum Flows 2. 2 Network Reliability u Communication Network u What is the maximum number of arc disjoint paths from.
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
CSCI 256 Data Structures and Algorithm Analysis Lecture 20 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some.
EMIS 8374 The Ford-Fulkerson Algorithm (aka the labeling algorithm) Updated 4 March 2008.
Theory of Computing Lecture 12 MAS 714 Hartmut Klauck.
TU/e Algorithms (2IL15) – Lecture 12 1 Linear Programming.
The Maximum Network Flow Problem
::Network Optimization:: Minimum Spanning Trees and Clustering Taufik Djatna, Dr.Eng. 1.
TU/e Algorithms (2IL15) – Lecture 8 1 MAXIMUM FLOW (part II)
The Maximum Network Flow Problem
Data Structures and Algorithms (AT70. 02) Comp. Sc. and Inf. Mgmt
Cycles and Paths vs functions
CS4234 Optimiz(s)ation Algorithms
The assignment problem
Algorithms and Networks
Lectures on Network Flows
Algorithms and Networks Hans Bodlaender
Algorithms and Networks
Chapter 6. Large Scale Optimization
Algorithms and Networks
Network Flow 2016/04/12.
Instructor: Shengyu Zhang
Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Introduction to Maximum Flows
Analysis of Algorithms
Algorithms (2IL15) – Lecture 7
EE5900 Advanced Embedded System For Smart Infrastructure
and 6.855J March 6, 2003 Maximum Flows 2
Flow Feasibility Problems
Algorithms and Networks
Advanced Graph Homer Lee 2013/10/31.
Chapter 6. Large Scale Optimization
Presentation transcript:

Minimum Cost Flow Algorithms and Networks

Algorithms and Networks: Minimum Cost Flow2 This lecture The minimum cost flow problem: statement and applications The cycle cancelling algorithm A polynomial time variant of cycle cancelling The successive shortest paths algorithm

Algorithms and Networks: Minimum Cost Flow3 Minimum Cost Flow I Edges have –Capacity c(u,v): bound on amount of flow that can go through the edge –Cost: cost(u,v): cost that must be paid per unit of flow that goes through the edge. Cost of flow f: –Sum over all (u,v) of: f (u,v) * cost(u,v).

Algorithms and Networks: Minimum Cost Flow4 Minimum cost flow problem Given: Network G, c, cost, s, t, and a target flow value r. Question: Find a flow from s to t with value r, with minimum cost.

Algorithms and Networks: Minimum Cost Flow5 Unbounded capacities Some edges may have unbounded capacities –If there is a cycle of negative cost with only edges with unbounded capacity: Arbitrary small cost (degenerate case) –Otherwise: simple transformation to bounded capacities E.g., set each unbounded capacity to sum of all bounded capacities

Algorithms and Networks: Minimum Cost Flow6 Separate demands Similar to max-flow with multiple sources and multiple sinks Or: work with “demand”, which can be positive or negative G s1s1 sksk t1t1 trtr t s

Algorithms and Networks: Minimum Cost Flow7 Nonnegative arc costs We may assume all costs are nonnegative. In case of negative costs: assume bounded capacity. Modify network to equivalent one with nonnegative costs: ba sbat Cost -r Cost r Capacity c Or work with separate demands Or work with separate demands Cost 0

Algorithms and Networks: Minimum Cost Flow8 Applications Transport problems Minimum cost matchings Reconstruction of Left Ventricle from X-ray projections –Image: 2d bit array; known are sums of columns, rows; probabilities for each bit –Look for image with correct row and column sums of maximum probability –Can be modelled as minimum cost flow problem

Algorithms and Networks: Minimum Cost Flow9 Application: Optimal loading of hopping airplane 12n b ij weight units (or passengers) can be transported from i to j Each gives a profit of f ij Plane can never carry more than p units How much units do we transport of each type for maximum profit? b ij weight units (or passengers) can be transported from i to j Each gives a profit of f ij Plane can never carry more than p units How much units do we transport of each type for maximum profit? Capacity i  j: p Node ij has supply b ij Cost from ij to i: - f ij Node i has demand sum over all b ji All other arcs infinite cap. All other costs 0

Cycles and circulations; paths and flows We can view: –Cycles as a special type of circulations –Paths as a special type of flows –If we have a directed cycle c, then we can see it as a circulation: c(e) = 1 when e is on c c(e) = 0 otherwise –If we have a path p from s to t, we can see it as a flow with value 1: p(e) = 1 when e is on p p(e) = 0 otherwise Algorithms and Networks: Minimum Cost Flow10

A&N: Maximum flow11 First: useful theorems on flows and circulations Theorem Let f be a circulation. Then f is a nonnegative linear combination of cycles in G. Proof. Ignore lower bounds. If f(v,w) = 0 everywhere, then it clearly holds. Otherwise, there is a directed cycle c in G with each edge e on c: f(e)>0 Let r be the minimum flow of an edge on c, i.e., r = min {f(e) | e on c} Use induction: the theorem also holds for f – cr –f-cr(e) = f(e) when e is not on c –f-cr(e) = f(e) – r when e is on c …

More on these linear combinations If circulation f is integer, then f can be written as an`integer scalared’ linear combination of cycles in G Corollary: a flow is the linear combination of cycles and paths from s to t. –Look at the circulation by adding an edge from t to s and giving it flow value(f). And, a flow f with each f(e) an integer is the integer scalared linear combination of cycles and paths from s to t Algorithms and Networks: Minimum Cost Flow12

Algorithms and Networks: Minimum Cost Flow13 Residual network Define the residual network G f of a flow in the setting of costs: Capacities as for maximum flow algorithms. If f (u,v)>0, then cost f (u,v) = cost(u,v), and cost f (v,u) = – cost(u,v).

Algorithms and Networks: Minimum Cost Flow14 Example ab Capacity 5, cost 3 Capacity 2, cost 6 Suppose we send 1 flow from a to b a Capacity 4, cost 3 Capacity 2, cost 6 Capacity 1, cost -3 b In G f :

Algorithms and Networks: Minimum Cost Flow15 Cycle cancelling algorithm Make a feasible flow f in the network while G f has a negative cycle do –Find a negative cycle C in G f –Let D be the minimum residual capacity c f of an edge on C –Add D units of flow to each edge on C: this is a new feasible flow of smaller cost Output f.

Algorithms and Networks: Minimum Cost Flow16 Cycle cancelling algorithm is correct Theorem: a flow f has minimum costs, if and only if G f has no negative cycle. –If G f has negative cycle, then we can improve f to one with smaller cost. –Suppose f is a flow, and f’ is an optimal flow. f’ – f is a circulation in G f, hence a linear combination of cycles, and if f is not optimal, then the total cost of these cycles is negative, so there is a negative cycle in this set: it is a cycle in G f.

Algorithms and Networks: Minimum Cost Flow17 More on the cycle cancelling algorithm No guarantee that it uses polynomial time. Corollary: if all costs, capacities, and target flow value are integral, then there is an optimal integer minimum cost flow. –The cycle cancelling algorithm finds an integer flow in this case. Variant: using always the minimum mean cost cycle gives a polynomial time algorithm!

Algorithms and Networks: Minimum Cost Flow18 Minimum mean-cost circulation algorithm Cycle cancelling algorithm but find always the minimum mean cost cycle and use that. –O(nm) time to find the cycle. –A theorem shows that O(nm 2 log 2 n) iterations are sufficient. –O(n 2 m 3 log 2 n) algorithm.

Algorithms and Networks: Minimum Cost Flow19 Successive shortest paths Start with flow f with f(u,v)=0 for all u,v. repeat until value(f ) = r –Find the shortest path P in G f from s to t –Let q be the minimum residual capacity of an edge on P. –Send min(q,r – value(f)) additional units of flow across P.

Time and correctness Time: possibly exponential time … Correctness: only if G has no cycle with negative cost Example where it goes wrong with negative cost: consider target flow r=0 Proof of correctness: next Algorithms and Networks: Minimum Cost Flow20

Algorithms and Networks: Minimum Cost Flow21 On the successive shortest paths algorithm If G has no negative cycle, then the algorithm gives the optimal answer. –Invariant: f has minimum cost among all flows with value value(f). Suppose we obtain f’ from f by sending across P. Let f’’ be a minimum cost flow with same value as f’. Write f’’ – f as weighted sum of paths from s to t in G f and circuits in G f. Argue that cost(f’ – f)  cost(f’’ – f), using that: –P is shortest path –Circuits have non-negative costs, by optimality of f.

Algorithms and Networks: Minimum Cost Flow22 Finally More efficient algorithms exist –Some use scaling techniques: Scaling on capacities Scaling on costs