COT 6936: Topics in Algorithms! Giri Narasimhan. ECS 254A / EC 2443; Phone: x3748

Similar documents
COT 6936: Topics in Algorithms! Giri Narasimhan. ECS 254A / EC 2443; Phone: x3748

CSC 8301 Design & Analysis of Algorithms: Linear Programming

Copyright 2007 Pearson Addison-Wesley. All rights reserved. A. Levitin Introduction to the Design & Analysis of Algorithms, 2 nd ed., Ch.

An example of LP problem: Political Elections

Network Flow. November 23, CMPE 250 Graphs- Network Flow November 23, / 31

Linear Programming. Linear Programming. Linear Programming. Example: Profit Maximization (1/4) Iris Hui-Ru Jiang Fall Linear programming

Lecture 10,11: General Matching Polytope, Maximum Flow. 1 Perfect Matching and Matching Polytope on General Graphs

Advanced Algorithms Linear Programming

Mathematical and Algorithmic Foundations Linear Programming and Matchings

Linear Programming. Readings: Read text section 11.6, and sections 1 and 2 of Tom Ferguson s notes (see course homepage).

Linear Programming. Widget Factory Example. Linear Programming: Standard Form. Widget Factory Example: Continued.

LECTURES 3 and 4: Flows and Matchings

CSE 417 Network Flows (pt 4) Min Cost Flows

Linear Programming. them such that they

Tutorial for Algorithm s Theory Problem Set 5. January 17, 2013

Linear and Integer Programming :Algorithms in the Real World. Related Optimization Problems. How important is optimization?

CS 473: Algorithms. Ruta Mehta. Spring University of Illinois, Urbana-Champaign. Ruta (UIUC) CS473 1 Spring / 36

Design and Analysis of Algorithms (V)

Linear Programming Motivation: The Diet Problem

Outline: Finish uncapacitated simplex method Negative cost cycle algorithm The max-flow problem Max-flow min-cut theorem

Section Notes 5. Review of Linear Programming. Applied Math / Engineering Sciences 121. Week of October 15, 2017

CSE 417 Network Flows (pt 3) Modeling with Min Cuts

Linear Programming 1

Preflow-Push Algorithm

Discrete Optimization 2010 Lecture 5 Min-Cost Flows & Total Unimodularity

Lecture 11: Maximum flow and minimum cut

Minimum Cost Edge Disjoint Paths

Linear Programming CISC4080, Computer Algorithms CIS, Fordham Univ. Linear Programming

4 Integer Linear Programming (ILP)

Chapter 5 Graph Algorithms Algorithm Theory WS 2012/13 Fabian Kuhn

Dual-fitting analysis of Greedy for Set Cover

Today. Maximum flow. Maximum flow. Problem

Lecture 3: Graphs and flows

Chapter 15 Introduction to Linear Programming

Chapter 7. Linear programming and reductions

Lecture 14: Linear Programming II

Linear Programming Duality and Algorithms

Linear Programming. Course review MS-E2140. v. 1.1

Combinatorial Optimization

Mathematics for Decision Making: An Introduction. Lecture 18

1 Linear programming relaxation

Lecture 3: Totally Unimodularity and Network Flows

Outline. CS38 Introduction to Algorithms. Linear programming 5/21/2014. Linear programming. Lecture 15 May 20, 2014

Solutions for Operations Research Final Exam

CS261: Problem Set #1

Linear Programming. Linear programming provides methods for allocating limited resources among competing activities in an optimal way.

Approximation slides 1. An optimal polynomial algorithm for the Vertex Cover and matching in Bipartite graphs

Some Advanced Topics in Linear Programming

Jessica Su (some parts copied from CLRS / last quarter s notes)

Simulation. Lecture O1 Optimization: Linear Programming. Saeed Bastani April 2016

CMPSCI611: The Simplex Algorithm Lecture 24

Introduction to Linear Programming

CS483 Analysis of Algorithms Lecture 09 Linear Programming 01

Artificial Intelligence

Example: profit maximization

CS599: Convex and Combinatorial Optimization Fall 2013 Lecture 14: Combinatorial Problems as Linear Programs I. Instructor: Shaddin Dughmi

Homework 2: Multi-unit combinatorial auctions (due Nov. 7 before class)

11 Linear Programming

The Simplex Algorithm

Convex Optimization CMU-10725

The Generalized Simplex Method for Minimizing a Linear Form under Linear Inequality Restraints

4 LINEAR PROGRAMMING (LP) E. Amaldi Fondamenti di R.O. Politecnico di Milano 1

11. APPROXIMATION ALGORITHMS

Math 5490 Network Flows

Notes for Lecture 20

Duality. Primal program P: Maximize n. Dual program D: Minimize m. j=1 c jx j subject to n. j=1. i=1 b iy i subject to m. i=1

DM545 Linear and Integer Programming. Lecture 2. The Simplex Method. Marco Chiarandini

CS599: Convex and Combinatorial Optimization Fall 2013 Lecture 1: Introduction to Optimization. Instructor: Shaddin Dughmi

Introduction to Mathematical Programming IE496. Final Review. Dr. Ted Ralphs

Easter Term OPTIMIZATION

Approximation Algorithms

Outline. Combinatorial Optimization 2. Finite Systems of Linear Inequalities. Finite Systems of Linear Inequalities. Theorem (Weyl s theorem :)

The Simplex Algorithm for LP, and an Open Problem

1. Lecture notes on bipartite matching February 4th,

BCN Decision and Risk Analysis. Syed M. Ahmed, Ph.D.

The Simplex Algorithm

CS261: Problem Set #2

Notes for Lecture 18

NETWORK OPTIMIZATION MODELS

Problem set 2. Problem 1. Problem 2. Problem 3. CS261, Winter Instructor: Ashish Goel.

Linear Programming and Integer Linear Programming

Lecture 16 October 23, 2014

16.410/413 Principles of Autonomy and Decision Making

Submodularity Reading Group. Matroid Polytopes, Polymatroid. M. Pawan Kumar

MA4254: Discrete Optimization. Defeng Sun. Department of Mathematics National University of Singapore Office: S Telephone:

Network flows and Menger s theorem

David G. Luenberger Yinyu Ye. Linear and Nonlinear. Programming. Fourth Edition. ö Springer

Lecture and notes by: Sarah Fletcher and Michael Xu November 3rd, Multicommodity Flow

CS 580: Algorithm Design and Analysis. Jeremiah Blocki Purdue University Spring 2018

Read: H&L chapters 1-6

Network Flow I. Lecture Overview The Network Flow Problem

Linear Programming Algorithms [Read Chapters G and H first.] Status: Half-finished.

15-451/651: Design & Analysis of Algorithms October 11, 2018 Lecture #13: Linear Programming I last changed: October 9, 2018

Cuts, Connectivity, and Flow

Linear Programming: Introduction

Approximation Algorithms

Maximum Flow Algorithms

Chapter 7. Network Flow. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

Homework 3 Solutions

3 INTEGER LINEAR PROGRAMMING

Transcription:

COT 6936: Topics in Algorithms! Giri Narasimhan ECS 254A / EC 2443; Phone: x3748 giri@cs.fiu.edu http://www.cs.fiu.edu/~giri/teach/cot6936_s12.html https://moodle.cis.fiu.edu/v2.1/course/view.php?id=174

Types of networks & Types of queries! Road, highway, rail Electrical power, water, oil, gas, sewer Internet, phone, wireless, sensor (1950s) How quickly can Soviet Union get supplies through its rail network to Europe? Which links to destroy to reduce flow to under a threshold? 2/6/12 COT 6936 2

Network Flow: Example! Capacity Source Sink 2/6/12 COT 6936 3

Network Flow: Example of a flow! Total Flow in Network = 11 + 8 = 19 Flow value along edge Capacity of edge 2/6/12 COT 6936 4

Network Flow! Directed graph G(V,E) with capacity function on edges given by non-negative function c: E(G) è R +. Capacity of each edge, e, is given by c(e) Source vertex s Sink vertex t Flow function f is a non-negative function of the edges f: E(G) è R + Capacity constraints: f(e) c(e) Flow conservation constraints: For all vertices except source and sink, sum of flow values along edges entering a vertex equals sum of flow values along edges leaving that vertex Flow value: sum of flow values from source vertex (or sum of flow into sink vertex) 2/6/12 COT 6936 5

Flow Conservation! For any legal flow function: Flow out of source = Flow into sink (Why?) 2/6/12 COT 6936 6

Network Flow: How to increase flow! Find path with residual capacity and increase flow along path. Path s to v 1 to v 3 to t has no residual capacity edge v 1 to v 3 is saturated Path s to v 2 to v 3 to t has residual capacity 2/6/12 COT 6936 7

Residual Flows and Augmenting Paths! Flow = 19 Augmenting Path Capacity of augmenting path = 4 Flow = 23 2/6/12 COT 6936 8

Residual Flow Network: Definition! Directed Graph G(V,E) with capacity function c and flow function f Residual flow network G f (V,E ) For every edge e = (u,v) in E with f(e) < c(e), there are two edges in E : (u,v) and (v,u) with capacities c(e) = f(e) and f(e), respectively For every edge e = (u,v) in E with f(e) = c(e), there is one edge in E : (v,u) with capacity f(e) For every edge e = (u,v) in E with f(e) = 0, there is one edge in E : (u,v) with capacity f(e) 2/6/12 COT 6936 9

Ford Fulkerson Algorithm! Initialize flow f to 0. While (there exists augmenting path p from s to t) do Augment flow along augmenting path p Return flow f as maximum flow from s to t 2/6/12 COT 6936 10

Ford Fulkerson Algorithm! Initialize flow f to 0. While (there exists directed path p from s to t in residual flow network G f ) do Augment flow along augmenting path p Return flow f as maximum flow from s to t 2/6/12 COT 6936 11

Ford-Fulkerson Method: Example! 2/6/12 COT 6936 12

Ford-Fulkerson Method: Example! A B 2/6/12 COT 6936 13

Ford-Fulkerson Method: Example! C D 2/6/12 COT 6936 14

Ford-Fulkerson Method: Example! C Max-Flow has been reached. Why? Cut with zero capacity has been found. Which Cut? ({s,v 1,v 2,v 4 },{v 3,t}) 2/6/12 COT 6936 15

Correctness of Ford-Fulkerson Method! Augmentation is possible if Every cut-set is NOT saturated Cut (S,T): Capacity = 26 Flow across cut = 19 Cut (S,T ): Capacity = 23 Flow across cut = 19 Theorem: Min-Cut = Max-Flow 2/6/12 COT 6936 16

Time Complexity! It can be arbitrarily large. Solution: When finding augmenting path, find the shortest path In that case, # of augmentations = O(mn) 2/6/12 COT 6936 17

More efficient Network Flow algorithms! Push-relabel algorithms [Goldberg, 87] Local algorithm, works on one vertex at a time Avoids maintaining flow conservation rule Excess flow in each node Height function O(mn 2 ) time complexity Can be improved to O(n 3 ) 2/6/12 COT 6936 18

Generalizations! Multiple sources and sinks. Can be reduced to single source and sink 2/6/12 COT 6936 19

Tasks Bipartite Matching! Machines Maximize the number of tasks matched to machines s t s t 2/6/12 COT 6936 20

Network Flow! Input: Directed graph G(V,E) with capacity function on edges given by non-negative function c: E(G) è R +. Capacity of each edge, e, is given by c(e) Source vertex s Sink vertex t Question: Find a flow function f with the maximum flow value 2/6/12 COT 6936 21

Min-Cost Network Flow! Input: Directed graph G(V,E) with capacity function on edges given by non-negative function c: E(G) è R +. Capacity of each edge, e, is given by c(e) Flow cost of each edge, e, is given by a(e) Implies that cost of flow in e is a(e) f(e) Total cost of flow = Σ a(e) f(e) Source vertex s Sink vertex t Flow required = F Question: Find min-cost flow function f with flow value = F 2/6/12 COT 6936 22

Minimum Path Cover in DAGs! Path Cover: set of vertex disjoint paths that cover all vertices Minimum Path Cover in directed acyclic graphs can be reduced to network flow (?) Examples: a d a d b c b c Can be covered with one path: a è b è d è c Cannot be covered with one path; needs at least two paths to cover all vertices 2/6/12 COT 6936 23

COT 6936: Topics in Algorithms! Linear Programming

Gaussian Elimination! Solving a system of simultaneous equations x 1-2x 3 = 2 x 2 + x 3 = 3 x 1 + x 2 - x 4 = 4 x 2 + 3x 3 + x 4 = 5 O(n 3 ) algorithm x 1-2x 3 = 2 x 2 + x 3 = 3 x 2 + 2x 3 - x 4 = 2 x 2 + 3x 3 + x 4 = 5 2/6/12 COT 6936 25

Linear Programming! Want more than solving simultaneous equations We have an objective function to optimize 2/6/12 COT 6936 26

Chocolate Shop [DPV book]! 2 kinds of chocolate milk [Profit: $1 per box] [Demand: 200] Deluxe [Profit: $6 per box] [Demand: 300] Production capacity: 400 boxes Goal: maximize profit Maximize x 1 + 6x 2 subject to constraints: x 1 200 x 2 300 x 1 + x 2 400 x 1, x 2 0 2/6/12 COT 6936 27

Diet Problem! Food type: Nutrients: F 1,,F m N 1,,N n Min daily requirement of nutrients: c 1,,c n Price per unit of food: b 1,,b m Nutrient N j in food F i : a ij Problem: Supply daily nutrients at minimum cost Min Σ i b i x i Σ i a ij x i c j x i 0 for 1 j n 2/6/12 COT 6936 28

Transportation Problem! Ports or Production Units: P 1,,P m Markets to be shipped to: M 1,,M n Min daily market need: r 1,,r n Port/production capacity: s 1,,s m Cost of transporting to M j from port P i : a ij Problem: Meet market need at minimum transportation cost 2/6/12 COT 6936 29

Workers: b 1,,b n Jobs: g 1,,g m Assignment Problem! Value of assigning person b i to job g j : a ij Problem: Choose job assignment to maximize value 2/6/12 COT 6936 30

Bandwidth Allocation Problem! Need: A B 2 units B C 2 units C A 2 units Connections: Short route Long route Revenue: A B pays $3 per unit B C pays $2 per unit C A pays $4 per unit 2/6/12 COT 6936 31

Bandwidth Allocation Problem! Maximize revenue by allocating bandwidth to connections along two routes without exceeding bandwidth capacities Max 3(x AB +x AB ) + 2(x BC +x BC ) + 4(x AC +x AC ) s.t. x AB + x AB + x BC + x BC 10 x AB + x AB + x AC + x AC 12 x BC + x BC + x AC + x AC 8 x AB + x BC + x AC 6; x AB + x AB 2; x BC + x BC 2 x AB + x BC + x AC 13; x AC + x AC 2 x AB + x BC + x AC 11;& all nonneg constraints 2/6/12 COT 6936 32

Standard LP! Maximize Σc j x j [Objective Function] Subject to Σa ij x j b j [Constraints] and x j 0 [Nonnegativity Constraints] Matrix formulation of LP Maximize c T x Subject to Ax b and x 0 2/6/12 COT 6936 33

Converting to standard form! Min -2x 1 + 3x 2 Subject to x 1 + x 2 = 7 x 1 2x 2 4 x 1 0 Max 2x 1-3x 2 Subject to x 1 + x 2 7 -x 1 - x 2-7 x 1 2x 2 4 x 1 0 2/6/12 COT 6936 34

Converting to standard form! Max 2x 1-3x 2 Subject to x 1 + x 2 7 -x 1 - x 2-7 x 1 2x 2 4 x 1 0 Max 2x 1 3(x 3 - x 4 ) Subject to x 1 + x 3 - x 4 7 -x 1 (x 3 - x 4 ) -7 x 1 2(x 3 - x 4 ) 4 x 1, x 3, x 4 0 x 2 is not constrained to be non-negative 2/6/12 COT 6936 35

Converting to Standard form! Max 2x 1 3x 2 + 3x 3 Subject to x 1 + x 2 x 3 7 -x 1 x 2 + x 3-7 x 1 2x 2 2x 3 4 x 1, x 2, x 3 0 2/6/12 COT 6936 36

Slack Form! Max 2x 1 3x 2 + 3x 3 Subject to x 1 + x 2 x 3 7 -x 1 x 2 + x 3-7 x 1 2x 2 2x 3 4 x 1, x 2, x 3 0 Max 2x 1 3x 2 + 3x 3 Subject to x 1 + x 2 x 3 + x 4 = 7 -x 1 x 2 + x 3 + x 5 = -7 x 1 2x 2 2x 3 + x 6 = 4 x 1, x 2, x 3, x 4, x 5, x 6 0 2/6/12 COT 6936 37

Duality! Max c T x Subject to Ax b and x 0 [Primal] Min y T b [Dual] Subject to y T A c T and y 0 2/6/12 COT 6936 38

Understanding Duality! Maximize x 1 + 6x 2 subject to constraints: x 1 200 (1) x 2 300 (2) x 1 + x 2 400 (3) x 1, x 2 0 (100,300) is feasible; value = 1900. Optimum? Adding 1 times (1) + 6 times (2) gives us x 1 + 6x 2 2000 How were mutipliers determined? Adding 1 times (3) + 5 times (2) gives us x 1 + 6x 2 1900 Certificate of Optimality for solution (100,300) 2/6/12 COT 6936 39

Understanding Duality! Maximize x 1 + 6x 2 subject to: x 1 200 (y 1 ) x 2 300 (y 2 ) [(100,300)] x 1 + x 2 400 (y 3 ) x 1, x 2 0 Different choice of multipliers gives us different bounds. We want smallest bound. Minimize 200y 1 + 300y 2 + 400y 3 subject to: y 1 + y 3 1 (x 1 ) y 2 + y 3 6 (x 2 ) [(0,5,1)] y 1, y 2 0 2/6/12 COT 6936 40

Duality Principle! Primal feasible values dual feasible values Max primal value = min dual value Duality Theorem: If a linear program has a bounded optimal value then so does its dual and the two optimal values are equal. 2/6/12 COT 6936 41

Visualizing Duality! Shortest Path Problem Build a physical model and between each pair of vertices attach a string of appropriate length To find shortest path from s to t, hold the two vertices and pull them apart as much as possible without breaking the strings This is exactly what a dual LP solves! Max x s -x t subject to x u -x v w uv for every edge (u.v) The taut strings correspond to the shortest path, i.e., they have no slack 2/6/12 COT 6936 42

Simplex Algorithm! Start at v, any vertex of feasible region while (there is neighbor v of v with better objective value) do set v = v Report v as optimal point and its value as optimal value What is a Vertex?, neighbor? Start vertex? How to pick next neighbor? 2/6/12 COT 6936 43

Simplex Algorithm: Example! 2,3,7 1,3,7 i.e., some inequalities satisfied as equalities Vertex: point where n hyperplanes meet; Neighbor: vertices sharing n-1 hyperplanes 2/6/12 COT 6936 44

Steps of Simplex Algorithm! In order to find next neighbor from arbitrary vertex, we do a change of origin (pivot) 2/6/12 COT 6936 45

Simplex Algorithm Example! 2/6/12 COT 6936 46

Simplex Algorithm Example! 2/6/12 COT 6936 47

Simplex Algorithm Example! 2/6/12 COT 6936 48

Simplex Algorithm: Degenerate vertices! i.e., some inequalities satisfied as equalities 2,3,4,5 2,3,7 1,3,7 Vertex: point where n hyperplanes meet; Neighbor: vertices sharing n-1 hyperplanes 2/6/12 COT 6936 49

Polynomial-time algorithms for LP! Simplex is not poly-time in the worst-case Khachiyan s ellipsoid algorithm: LP is in P Karmarkar s interior-point algorithm Good implementations for LP exist Works very well in practice More competitive than the poly-time methods for LP 2/6/12 COT 6936 50

Integer Linear Programming! LP with integral solutions NP-hard If A is a totally unimodular matrix, then the LP solution is always integral. A TUM is a matrix for which every nonsingular submatrix has determinant 0, +1 or -1. A TUM is a matrix for which every nonsingular submatrix has integral inverse. 2/6/12 COT 6936 51

Vertex Cover as an LP?! For vertex v, create variable x v For edge (u,v), create constraint x u + x v 1 Objective function: Σx v Additional constraints: x v 1 Doesn t work because x v needs to be from {0,1} 2/6/12 COT 6936 52