Introduction to Algorithms

Slides:



Advertisements
Similar presentations
1 LP, extended maxflow, TRW OR: How to understand Vladimirs most recent work Ramin Zabih Cornell University.
Advertisements

1 Outline relationship among topics secrets LP with upper bounds by Simplex method basic feasible solution (BFS) by Simplex method for bounded variables.
The simplex algorithm The simplex algorithm is the classical method for solving linear programs. Its running time is not polynomial in the worst case.
1 LP Duality Lecture 13: Feb Min-Max Theorems In bipartite graph, Maximum matching = Minimum Vertex Cover In every graph, Maximum Flow = Minimum.
Geometry and Theory of LP Standard (Inequality) Primal Problem: Dual Problem:
Linear Programming (LP) (Chap.29)
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2002 Lecture 8 Tuesday, 11/19/02 Linear Programming.
1 Introduction to Linear Programming. 2 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. X1X2X3X4X1X2X3X4.
Copyright (c) 2003 Brooks/Cole, a division of Thomson Learning, Inc
Dragan Jovicic Harvinder Singh
Optimization of thermal processes2007/2008 Optimization of thermal processes Maciej Marek Czestochowa University of Technology Institute of Thermal Machinery.
Chapter 6 Maximum Flow Problems Flows and Cuts Augmenting Path Algorithm.
Basic Feasible Solutions: Recap MS&E 211. WILL FOLLOW A CELEBRATED INTELLECTUAL TEACHING TRADITION.
MAXIMUM FLOW Max-Flow Min-Cut Theorem (Ford Fukerson’s Algorithm)
Linear programming Thomas S. Ferguson University of California at Los Angeles Compressive Sensing Tutorial PART 3 Svetlana Avramov-Zamurovic January 29,
Chapter 7 LINEAR PROGRAMMING.
The Simplex Method: Standard Maximization Problems
CS38 Introduction to Algorithms Lecture 15 May 20, CS38 Lecture 15.
Linear Programming.
1 Linear Programming Jose Rolim University of Geneva.
Instructor Neelima Gupta Table of Contents Lp –rounding Dual Fitting LP-Duality.
CSCI 3160 Design and Analysis of Algorithms Tutorial 6 Fei Chen.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2006 Lecture 9 Wednesday, 11/15/06 Linear Programming.
Linear Programming and Approximation
Approximation Algorithms
Finite Mathematics & Its Applications, 10/e by Goldstein/Schneider/SiegelCopyright © 2010 Pearson Education, Inc. 1 of 99 Chapter 4 The Simplex Method.
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.
Computational Methods for Management and Economics Carla Gomes
Optimization Linear Programming and Simplex Method
The Simplex Method.
Linear Programming – Max Flow – Min Cut Orgad Keller.
Chapter 4 The Simplex Method
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2008 Lecture 9 Tuesday, 11/18/08 Linear Programming.
Chapter 15 Constrained Optimization. The Linear Programming Model Let : x 1, x 2, x 3, ………, x n = decision variables Z = Objective function or linear.
Algorithms CISC 4080/CISC 5825 Linear Programming, Simplex Method and Duality Theory Dr Kamesam Graduate School Of Business Fordham University.
Approximation Algorithms Department of Mathematics and Computer Science Drexel University.
Linear Programming Data Structures and Algorithms A.G. Malamos References: Algorithms, 2006, S. Dasgupta, C. H. Papadimitriou, and U. V. Vazirani Introduction.
Duality Theory  Every LP problem (called the ‘Primal’) has associated with another problem called the ‘Dual’.  The ‘Dual’ problem is an LP defined directly.
TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AA A A A A A A A A Image:
Hon Wai Leong, NUS (CS6234, Spring 2009) Page 1 Copyright © 2009 by Leong Hon Wai CS6234: Lecture 4  Linear Programming  LP and Simplex Algorithm [PS82]-Ch2.
Max Flow – Min Cut Problem. Directed Graph Applications Shortest Path Problem (Shortest path from one point to another) Max Flow problems (Maximum material.
Linear Program Set Cover. Given a universe U of n elements, a collection of subsets of U, S = {S 1,…, S k }, and a cost function c: S → Q +. Find a minimum.
3.4: Linear Programming Objectives: Students will be able to… Use linear inequalities to optimize the value of some quantity To solve linear programming.
15.082J and 6.855J March 4, 2003 Introduction to Maximum Flows.
Hon Wai Leong, NUS (CS6234, Spring 2009) Page 1 Copyright © 2009 by Leong Hon Wai CS6234: Lecture 4  Linear Programming  LP and Simplex Algorithm [PS82]-Ch2.
OR Chapter 8. General LP Problems Converting other forms to general LP problem : min c’x  - max (-c)’x   = by adding a nonnegative slack variable.
CPSC 536N Sparse Approximations Winter 2013 Lecture 1 N. Harvey TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAAAAAAAAA.
Lecture.6. Table of Contents Lp –rounding Dual Fitting LP-Duality.
1 Introduction to Linear Programming. 2 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. X1X2X3X4X1X2X3X4.
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
Linear Programming: Formulations, Geometry and Simplex Method Yi Zhang January 21 th, 2010.
TU/e Algorithms (2IL15) – Lecture 12 1 Linear Programming.
Copyright © 2006 Brooks/Cole, a division of Thomson Learning, Inc. Linear Programming: An Algebraic Approach 4 The Simplex Method with Standard Maximization.
The minimum cost flow problem. Solving the minimum cost flow problem.
Approximation Algorithms Duality My T. UF.
Approximation Algorithms based on linear programming.
1 Simplex algorithm. 2 The Aim of Linear Programming A Linear Programming model seeks to maximize or minimize a linear function, subject to a set of linear.
TU/e Algorithms (2IL15) – Lecture 12 1 Linear Programming.
Tuesday, March 19 The Network Simplex Method for Solving the Minimum Cost Flow Problem Handouts: Lecture Notes Warning: there is a lot to the network.
The Simplex Method. and Maximize Subject to From a geometric viewpoint : CPF solutions (Corner-Point Feasible) : Corner-point infeasible solutions 0.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Spring, 2010 Lecture 9 Tuesday, 4/20/10 Linear Programming 1.
Linear Programming Many problems take the form of maximizing or minimizing an objective, given limited resources and competing constraints. specify the.
LINEAR PROGRAMMING.
The minimum cost flow problem
Linear Programming (LP) (Chap.29)
Linear Programming.
Chapter 5. The Duality Theorem
Flow Feasibility Problems
Maximum Flow Problems in 2005.
Linear Constrained Optimization
Presentation transcript:

Introduction to Algorithms Linear Programming My T. Thai @ UF

New crop problem A farmer: Has 10 acres to plant in wheat and rye Has Only $1200 to spend Has to plant at least 7 acres Has to get the planting done in 12 hours Each acre of wheat costs $200 and takes an hour to plant and gives $500 profit Each acre of rye costs $100 and takes 2 hours to plant and gives $300 profit Goal: Compute the numbers of acres of each should be planted to maximize profits x: # of wheat acres y: # of rye acres My T. Thai mythai@cise.ufl.edu

Linear program A linear programming problem is the problem of maximizing or minimizing a linear function subject to linear constraints (equalities and inequalities) E.g. Objective function Constraints My T. Thai mythai@cise.ufl.edu

Formulate shortest path as an LP Triangle inequalities: At the source vertex: ds = 0 dt is less than weights of all paths from s to t => dt is the maximum value that less than weights of all paths from s to t We have the following: My T. Thai mythai@cise.ufl.edu

Max Flow Capacity constraints: Conservation constraints: We have the following: My T. Thai mythai@cise.ufl.edu

Minimum-cost flow Pay cost to transmit flow fuv through edge (u, v) Wish to send d units with the minimized cost My T. Thai mythai@cise.ufl.edu

Multicommodity flow Has k commodities; ith commodity is defined by a triple Total flow of all commodities through an edge does not exceed its capacity Find a feasible flow My T. Thai mythai@cise.ufl.edu

Some Notations Minimization (maximization) linear program: the value of objective function is minimized (maximized) Feasible (infeasible) solution: a setting of variables satisfies all the constraints (conflicts at least one constraint) Feasible region: set of feasible solutions Objective value: value of the objective function at a particular point Optimal solution: objective value is maximum over all feasible solutions Optimal objective value: objective value of optimal solution The linear program is infeasible if it has no feasible solutions; otherwise it is feasible The linear program is unbounded if the optimal objective value is infinite My T. Thai mythai@cise.ufl.edu

Standard form Concise representation: My T. Thai mythai@cise.ufl.edu

Convert into standard form My T. Thai mythai@cise.ufl.edu

Example My T. Thai mythai@cise.ufl.edu (negate objective function) (replace equality) (replace x2) (negate constrain and change variable name) My T. Thai mythai@cise.ufl.edu

Geometry of Linear Programming Theorem 1 Feasible region of an LP is convex Proof: Feasible region is the intersection of half spaces defined by the constraints. Each half space is convex. My T. Thai mythai@cise.ufl.edu

Example My T. Thai mythai@cise.ufl.edu

Feasibility and Infeasibility Simple solution: try all vertices of polyhedron  running time:  How to refine this approach? My T. Thai mythai@cise.ufl.edu

Simplex method Start off from a vertex, which is called a basic feasible solution Iteratively move along an edge of the polyhedron to another vertex toward the direction of optimization For each move, need to make sure that the objective function is not decreased Observation: when moving from a vertex to another vertex, an inequality achieves equality My T. Thai mythai@cise.ufl.edu

Questions Arise My T. Thai mythai@cise.ufl.edu

Slack form All inequality constraints are non-negativity constraints Convert by introducing slack variables nonbasic variables Basic variables My T. Thai mythai@cise.ufl.edu

Concise representation of slack form z: the value of the objective function N: the set of indices of the nonbasic variables (|N| = n) B: the set of indices of the basic variables (|B| = m) v: an optional constant term in the objective function A tuple (N, B, A, b, c, v) represents the slack form maximize My T. Thai mythai@cise.ufl.edu

Simplex algorithm Basic solution: all nonbasic variables equals 0 Each iteration converts one slack form into an equivalent slack form s.t. the objective value is not decreased Choose a nonbasic variable xe (entering variable) such that its increase makes the objective value increase Keeping all constraint satisfied, raise the variable raise it until some basic variable xl (leaving variable) becomes 0 Exchange the roles of that basic variable and the chosen nonbasic variable My T. Thai mythai@cise.ufl.edu

Example My T. Thai mythai@cise.ufl.edu

Substitute x_2 = x_3 = 0 to the slack variables, we have: My T. Thai mythai@cise.ufl.edu

My T. Thai mythai@cise.ufl.edu

Cycling SIMPLEX may run forever if the slack forms at two different iterations of SIMPLEX are identical (cycling phenomenon) We need specific rule of picking the entering and leaving variables There are quite a few methods to prevent cycling. The one we just used is called Bland’s pivoting rule My T. Thai mythai@cise.ufl.edu

Other Pivoting Rules My T. Thai mythai@cise.ufl.edu

Time Complexity My T. Thai mythai@cise.ufl.edu

Duality Given a primal problem: The dual is: P: min cTx subject to Ax ≥ b, x ≥ 0 The dual is: D: max bTy subject to ATy ≤ c, y ≥ 0 My T. Thai mythai@cise.ufl.edu

An Example My T. Thai mythai@cise.ufl.edu

Weak Duality Theorem Weak duality Theorem: Let x and y be the feasible solutions for P and D respectively, then: Proof: Follows immediately from the constraints My T. Thai mythai@cise.ufl.edu

Weak Duality Theorem This theorem is very useful Suppose there is a feasible solution y to D. Then any feasible solution of P has value lower bounded by bTy. This means that if P has a feasible solution, then it has an optimal solution Reversing argument is also true Therefore, if both P and D have feasible solutions, then both must have an optimal solution. My T. Thai mythai@cise.ufl.edu

Hidden Message ≥ Strong Duality Theorem: If the primal P has an optimal solution x* then the dual D has an optimal solution y* such that: cTx* = bTy* My T. Thai mythai@cise.ufl.edu

Complementary Slackness Theorem: Let x and y be primal and dual feasible solutions respectively. Then x and y are both optimal iff two of the following conditions are satisfied: (ATy – c)j xj = 0 for all j = 1…n (Ax – b)i yi = 0 for all i = 1…m My T. Thai mythai@cise.ufl.edu

Proof of Complementary Slackness As in the proof of the weak duality theorem, we have: cTx ≥(ATy)Tx = yTAx ≥ yTb (1) From the strong duality theorem, we have: (2) (3) My T. Thai mythai@cise.ufl.edu

Proof (cont) Note that and We have: x and y optimal  (2) and (3) hold  both sums (4) and (5) are zero  all terms in both sums are zero (?)  Complementary slackness holds (4) (5) My T. Thai mythai@cise.ufl.edu

Why do we care? It’s an easy way to check whether a pair of primal/dual feasible solutions are optimal Given one optimal solution, complementary slackness makes it easy to find the optimal solution of the dual problem May provide a simpler way to solve the primal My T. Thai mythai@cise.ufl.edu

Some examples Solve this system: My T. Thai mythai@cise.ufl.edu

Min-Max Relations What is a role of LP-duality Max-flow and Min-Cut My T. Thai mythai@cise.ufl.edu

Max Flow in a Network Definition: Given a directed graph G=(V,E) with two distinguished nodes, source s and sink t, a positive capacity function c: E → R+, find the maximum amount of flow that can be sent from s to t, subject to: Capacity constraint: for each arc (i,j), the flow sent through (i,j), fij bounded by its capacity cij Flow conservation: at each node i, other than s and t, the total flow into i should equal to the total flow out of i My T. Thai mythai@cise.ufl.edu

An Example 3 3 4 4 4 3 2 4 3 4 3 2 4 2 1 t s 1 3 1 1 3 2 2 3 2 1 2 5 My T. Thai mythai@cise.ufl.edu

Formulate Max Flow as an LP Capacity constraints: 0 ≤ fij ≤ cij for all (i,j) Conservation constraints: We have the following: My T. Thai mythai@cise.ufl.edu

LP Formulation (cont) 3 3 4 4 4 3 2 4 3 4 3 2 4 3 2 1 t 1 s 1 1 2 3 2 3 2 4 3 4 3 2 4 3 2 1 t 1 s 1 1 2 3 2 3 1 2 2 5 ∞ My T. Thai mythai@cise.ufl.edu

LP Formulation (cont) My T. Thai mythai@cise.ufl.edu

Min Cut Capacity of any s-t cut is an upper bound on any feasible flow If the capacity of an s-t cut is equal to the value of a maximum flow, then that cut is a minimum cut My T. Thai mythai@cise.ufl.edu

Max Flow and Min Cut My T. Thai mythai@cise.ufl.edu

Solutions of IP Consider: Let (d*,p*) be the optimal solution to this IP. Then: ps* = 1 and pt* = 0. So define X = {pi | pi = 1} and $\bar X$ = {pi | pi = 0}. Then we can find the s-t cut dij* =1. So for i in X and j in $\bar X$, define dij = 1, otherwise dij = 0. Then the object function is equal to the minimum s-t cut My T. Thai mythai@cise.ufl.edu