Minimum Cost Flow Lecture 5: Jan 25. Problems Recap Bipartite matchings General matchings Maximum flows Stable matchings Shortest paths Minimum spanning.

Slides:



Advertisements
Similar presentations
Maximum flow Main goals of the lecture:
Advertisements

Bipartite Matching, Extremal Problems, Matrix Tree Theorem.
Introduction to Algorithms
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
1 Maximum flow sender receiver Capacity constraint Lecture 6: Jan 25.
Piyush Kumar (Lecture 6: MaxFlow MinCut Applications)
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.
Chapter 10: Iterative Improvement The Maximum Flow Problem The Design and Analysis of Algorithms.
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 Weighted Bipartite Matching Lecture 4: Jan Weighted Bipartite Matching Given a weighted bipartite graph, find a matching with maximum total weight.
Advanced Algorithm Design and Analysis (Lecture 8) SW5 fall 2004 Simonas Šaltenis E1-215b
Lectures on Network Flows
Nick McKeown Spring 2012 Maximum Matching Algorithms EE384x Packet Switch Architectures.
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
Matchings Lecture 3: Jan 18. Bipartite matchings revisited Greedy method doesn’t work (add an edge with both endpoints free)
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.
1 Bipartite Matching Lecture 3: Jan Bipartite Matching A graph is bipartite if its vertex set can be partitioned into two subsets A and B so that.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2004 Lecture 5 Wednesday, 10/6/04 Graph Algorithms: Part 2.
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
NetworkModel-1 Network Optimization Models. NetworkModel-2 Network Terminology A network consists of a set of nodes and arcs. The arcs may have some flow.
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.
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.
MAX FLOW APPLICATIONS CS302, Spring 2012 David Kauchak.
CS 361 – Chapter 16 Final thoughts on minimum spanning trees and similar problems Flow networks Commitment: –Decide on presentation order.
CS223 Advanced Data Structures and Algorithms 1 Maximum Flow Neil Tang 3/30/2010.
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.
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.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 23.
CSEP 521 Applied Algorithms Richard Anderson Lecture 8 Network Flow.
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
EMIS 8374 The Ford-Fulkerson Algorithm (aka the labeling algorithm) Updated 4 March 2008.
Prof. Swarat Chaudhuri COMP 382: Reasoning about Algorithms Fall 2015.
Theory of Computing Lecture 12 MAS 714 Hartmut Klauck.
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,
CSE 421 Algorithms Richard Anderson Lecture 21 Shortest Paths and Network Flow.
::Network Optimization:: Minimum Spanning Trees and Clustering Taufik Djatna, Dr.Eng. 1.
Minimum Cost Flow Algorithms and Networks. Algorithms and Networks: Minimum Cost Flow2 This lecture The minimum cost flow problem: statement and applications.
The Maximum Network Flow Problem
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
CS4234 Optimiz(s)ation Algorithms
Algorithm Design and Analysis
Lectures on Network Flows
Richard Anderson Lecture 23 Network Flow
Maximum Flow 9/13/2018 6:12 PM Presentation for use with the textbook, Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015.
Max Flow min Cut.
Special Graphs: Modeling and Algorithms
Bipartite Matching and Other Graph Algorithms
Edmonds-Karp Algorithm
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
Introduction Basic formulations Applications
Lecture 19-Problem Solving 4 Incremental Method
Analysis of Algorithms
Richard Anderson Lecture 23 Network Flow
Richard Anderson Lecture 23 Network Flow
Richard Anderson Lecture 21 Network Flow
Flow Networks and Bipartite Matching
Algorithms (2IL15) – Lecture 7
EE5900 Advanced Embedded System For Smart Infrastructure
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
Lecture 21 Network Flow, Part 1
Richard Anderson Lecture 22 Network Flow
Special Graphs: Modeling and Algorithms
Richard Anderson Lecture 22 Network Flow
Presentation transcript:

Minimum Cost Flow Lecture 5: Jan 25

Problems Recap Bipartite matchings General matchings Maximum flows Stable matchings Shortest paths Minimum spanning trees Minimum Cost Flows Linear programming

Flows An s-t flow is a function f on the edges which satisfies: (capacity constraint) (conservation of flows) Value of the flow

Minimum Cost Flows Goal: Build a cheap network to satisfy the flow requirement. A directed graph G A source vertex s A sink vertex t A capacity function c on the edges, i.e. c:E->R A cost function w on the edges, i.e. w:E->R A flow requirement k (optional) Output: a maximum s-t flow f which minimizes Σf(e) w(e) Input:

Special cases Shortest path: find a shortest path between s and t A minimum cost flow with k = 1 Maximum flow: find a maximum flow between s and t Every edge in the original graph has cost 0. Disjoint paths: connect s and t by k paths with min # of edges Every edge in the original graph has cost 1 and capacity 1.

Stuctures Recap Bipartite matchings Maximum flows Shortest paths Minimum Cost Flows M-augmenting paths Residual graph augmenting paths ???

Residual Graph c(e) = 10 f(e) = 2 c(e) = 8 c(e) = 2

Maximum Flow Algorithm A larger flow because: (1)Flow conservations (2)More flow out from s No directed path from s to t  The current flow achieves the capacity of an s-t cut

Minimum Cost Flow Algorithm? What is the augmenting stucture? Try to use residual graphs Two parameters: value and cost of the flow

Residual Graph c(e) = 10 f(e) = 2 c(e) = 8 c(e) = 2 c(e) = 10, w(e) f(e) = 2 c(e) = 8, w(e) c(e) = 2, -w(e) Max Flow Min-cost Flow

What is the augmenting structure? Matchings M-augmenting paths Idea: Imagine a bigger matching and consider the union. Maximum flows Directed paths in residual graphs Idea: Keep flow conservations and increase the flow from s.

What is the augmenting structure? What would happen in the residual graphs? Minimum cost flows Strategy: start with a maximum flow and improve the cost? Try: Imagine a cheaper flow.

Finding the augmenting structure An s-t flow f of value k with total cost W Idea: Consider the union s t s t An s-t flow f * of value k with total cost W * s t s t Residual flow f -1

Cycle decompositions Since W > W*, we have W* - W < 0. Therefore, there is a negative cost directed cycle. In the union of f -1 ∪ f*, every vertex has indegree = outdegree. Eulerian digraphs Every Eulerian graph can be decomposed into directed cycles.

Negative cycles If we have a cheaper flow, then there exists a negative cycle. Suppose we have a negative cycle. By sending a flow along the cycle, flow conservations are kept in every vertex, and so the value of the flow is the same. And the cost decreases! Key: A flow has minimum cost  there is no negative cycle in the residual graph!

Minimum Cost Flow Algorithm A cheaper flow because: (1)Flow conservations (2)Negative cost No negative cost directed cycle  The current flow is of minimum cost.

Complexity Assume edge capacity between -C to C, cost between 1 to W At most O(mCW) iterations Finding a negative cycle in O(mn) time (Bellman-Ford) Total running time O(nm 2 CW)

Successive Shortest Path Algorithm Minimum cost flows Strategy 1: start with a maximum flow and improve the cost. Strategy 2: keep flow cost minimum and increase the flow value. Algorithm Start with an empty flow Always find an augmenting path with minimum cost. Complexity: O(n 2 C) · shortest path algorithm

Speeding Up Maximum Flow: shortest augmenting path O(n 2 m) capacity scaling O(nm + n 2 log(C)) Minimum Cost Flow: min mean-length cycle O(n 2 m 3 log(n)) capacity scaling O((m log(n))(m + n log(n))

Weighted Bipartite Matchings Goal: Find a matching with maximum total weight Reduce to min-cost flow by adding a source and a sink.

The Transportation Problem Input: p plants, each has supply s(i) q warehouses, each has demand t(j) cost of shipping from plant i to warehouse j is d(i,j) Goal: Find a cheapest shipping plan to satisfy all the demands.

Optimal Delivery n a car with capacity p going from station 1 to n. delivery request from station i to station j is r(i,j), each unit gains c(i,j) dollars. Goal: Find a delivery plan to maximize the profit.