Lecture 17 Bipartite Matching and Maximum Flow Motivation
Lecture 17 Bipartite Matching and Maximum Flow
Motivation: Classroom Assignment • There are n 1 courses and n 2 classrooms. • Because of different requirements (capacity, facility, location etc. ) each course can only use a subset of classrooms. • For each course, we are given the list of classrooms that it can use. • Goal: Find a way to schedule all courses in the classrooms. (each course only need one classroom, and each classroom can only hold one course)
Modeling as a graph problem Edge (i, j): Course i can be scheduled into classroom j Courses Classrooms Solution: A set of edges that do not share any vertices. (a matching)
Linear Program for Matching •
More General Problem: Max Flow • Given a (directed) graph G, where edges (i, j) have capacities ci, j, a starting vertex s and an ending vertex t. • Goal: Find a maximum “flow” that goes from s to t. • Flow constraints: • 1. Flow on every edge cannot be more than capacity. • 2. Flow conservation: for every vertex other than s and t, incoming flow needs to be equal to outgoing flow.
Using Max Flow to solve Max Matching 1 1 S 1 1 1 t 1
Linear Program for Max Flow •
Dual of Max Flow LP •
Interpreting the dual •
Min Direct Cut •
Max-Flow Min-Cut Theorem • For every graph G and vertex s, t, the value of the maximum flow is equal to the value of the minimum cut. • Strong Duality of LP • solution to the cut LP is always integral.
Flows with costs • One can also assign a cost/profit for each edge in a flow graph, then it’s possible to ask more questions • Max total profit • Min total cost • Max total profit for a certain flow value • Min total cost for the maximum flow value. • All of these can be solved using LP.
- Slides: 12