390 likes | 475 Views
Solving Linear Programs. LP Standard Form. Max Z = c 1 x 1 + c 2 x 2 + … + c n x n Subject to (s.t.) a 11 x 1 + a 12 x 2 + … + a 1n x n b 1 a 21 x 1 + a 22 x 2 + … + a 2n x n b 2 … a m1 x 1 + a m2 x 2 + … + a mn x n b m x 1 0, x 2 0, …, x n 0.
E N D
LP Standard Form Max Z = c1x1 + c2x2 + … + cnxn Subject to (s.t.) a11x1 + a12x2 + … + a1nxnb1 a21x1 + a22x2 + … + a2nxnb2 … am1x1 + am2x2 + … + amnxnbm x1 0, x2 0, …, xn 0 Formally: Max Z = cj xj s.t. aij xjbj i = 1, … , m xj 0 j = 1, … , m
Interior Point Solution • Feasible? Yes • Optimal? Never Geometric concepts in LP Corner Point solution CPF:Corner Point Feasible solution polytope X We search the optimal solution among the CPF points!!
Product Mix Example Product Mix LP. A potter produces two products, a pitcher and a bowl. It takes about 1 hour to produce a bowl and requires 4 pounds of clay. A pitcher takes about 2 hours and consumes 3 pounds of clay. The profit on a bowl is $40 and $50 on a pitcher. She works 40 hours weekly, has 120 pounds of clay available each week, and wants more profits. Max Z = 40x + 50y profits s.t. 1x + 2y 40 hours 4x + 3y 120 clay x, y 0 non-negativity
Standard & Augmented Forms Standard Form Max Z = 40x1+ 50x2 s.t. 1x1+ 2x2 40 4x1 + 3x2 120 x1 , x2 0 Augmented Form Max Z = 40x1+ 50x2 s.t. 1x1+ 2x2+ s1= 40 4x1 + 3x2 + s2= 120 x1 , x2 , s1 , s2 0 s1 and s2 are called slack variables
x2 40 20 x1 30 40 Geometric Representation Max Z = 40x1+ 50x2 s.t. 1x1+ 2x2+ s1 = 40 4x1 + 3x2+ s2= 120 x1 = 0 x2= 0 s1 = 40 s2= 120 Z = 0 24,8
x2 40 20 ? x1 30 40 Geometric Representation Max Z = 40x1+ 50x2 s.t. 1x1+ 2x2+ s1 = 40 4x1 + 3x2+ s2 = 120 x1 = 0 x2=20 s1 = 0 s2=60 Z = 1,000 Z = 40x1 + 50(40-x1-s1)/2 = 1000+15x1-25s1
x2 40 20 x1 30 40 Geometric Representation Max Z = 40x1+ 50x2 s.t. 1x1+ 2x2+ s1 = 40 4x1+ 3x2+ s2 = 120 x1 = 24 x2= 8 s1 = 0 s2= 0 Z = 1,360
Finite Number of CPF Solutions We have m+n variables, and m constraints. Each Corner-point solution is identified by m basic variables, setting the other m variables to 0. Hence the number of corner-point solutions: Example:m=50 constraints, n=100 decision variables Greater than thenumber of atoms in Universe!
Algebraic Representation Max Z = 40x1+ 50x2 s.t. 1x1+ 2x2+ s1 = 40 4x1 + 3x2+ s2 = 120 • 2 equations in 4 unknowns • Multiple solutions (4 feasible) • “Simplex Method”: guided search to move to optimal solution
Algebraic Representation Max Z = 3x1 + 5x2 s.t. x1+ x3 = 4 2x2 + x4 = 12 3x1 + 2x2 + x5 = 18 xi ≥ 0 • Initialization: start at any CPF solution • Iterative step: move to “better” adjacent CPF until optimum is reached • Extensive use of Gaussian elimination
Gaussian elimination Eliminating a variable from all but one equation. We do this for each “entering basic variable”, a variable that was non-basic in the current iteration and we want it to be basic in the next iteration Let xk be this variable. The Gaussian transformation is: a‘ij = aij – ( aik amj / amk ) The element amkis called the PIVOT - aijaik amjamk x /
Simplex Method - Algebraic Representation Z - 3x1- 5x2 = 0 x1 + x3 = 4 2x2 + x4 = 12 3x1 + 2x2 + x5 = 18 xi ≥ 0. Base solution for startup: x3, x4 and x5 • First iteration • x2 entering: coeff = -5 the most negative • - x4 leaving: 12/2 = 6 the least positive ratio of RHS/coeff • - We apply Gaussian elimination with the indicated pivot • Z - 3x1+ 2.5x4 = 30 • x1 + x3 = 4 • x2 + 0.5x4 = 6 • 3x1 - x4 + x5 = 6
Simplex Method - Algebraic Representation Z - 3x1+ 2.5x4 = 30 x1 + x3 = 4 x2 + 0.5x4 = 6 3x1 - x4 + x5 = 6 • Second iteration • x1 entering: coeff = -3 the most negative • - x5 leaving: 6/3 = 2 the least positive ratio of RHS/coeff • Z + 1.5x4 + x5= 36 • x3 + 1/3x4 - 1/3x5 = 2 • x2 + 0.5x4 = 6 • x1 -1/3 x4 +1/3 x5 = 2 • Optimum, and no degeneracy!
Theory of the Simplex Method • The optimal solution of an LP must be a corner-point feasible (CPF) solution • If there are alternate optima, then at least two must be adjacent CPF solutions • There are a finite number of CPF solutions • A CPF solution is optimal if there are no other adjacent CPF solutions that are better (Convexity of the Feasible region)
X The case of Minimization Equality Constraints Not Feasible!
3 X 2 (2,1) 3 4 Equality Constraints Max Z = 2x1+ 3x2 s.t. 1x1+ 2x2 4 x1 + x2= 3 x1 , x2 0 Note: x1 = x2= 0 is notfeasible How to achieve feasibility?
M is a VERY big number Big M Method Strategy: Start feasible, then drive artificial variables from the basis with M Max Z = 2x1+ 3x2 s.t. 1x1+ 2x2 4 x1 + x2= 3 x1 , x2 0 Max Z = 2x1+ 3x2 - M a1 s.t. 1x1+ 2x2+ s1 = 4 x1 + x2+ a1 = 3 x1 , x2 , s1, a1 0 Add artificial variable a1 Note: x1 = x2= 0 is nowfeasible
Big M Augmented Form Max Z = 2x1+ 3x2 –M a1 = 0 s.t. 1x1+ 2x2+ s1 = 4 x1 + x2+ a1 = 3 x1 , x2 , s1, a1 0 The term (–Ma1)in the expression of Z forces a1 = 0 in the optimal solution.
Big M Augmented Form Max Z = 2x1+ 3x2 –M a1 s.t. x1+ 2x2+ s1 = 4 x1 + x2+ a1 = 3 x1 , x2 , s1, a1 0 We eliminate the basic variables from Z: Z - 2x1 - 3x2 + M a1 = 0 Mx1 + Mx2+ Ma1 - 3M = 0 ___________________________ Z - (M+2)x1- (M+3)x2 + 3M = 0
Big M Tableau Initial Solution x1 = 0 x2=0 s1 =4 a1 = 3 Max Z = (M+2)x1+ (M+3)x2 = 3M s.t. 1x1+ 2x2+ s1 = 4 x1 + x2+ a1 = 3 x1 , x2 , s1, a1 0
“Greater Than” Constraints Max Z = 2x1 + 5x2 + 3x3 s.t. 1x1– 2x2 + x3 20 2x1 + 4x2 + x3 = 50 x1 , x2 , x3 0 Subtract slack variableto create equality 1x1– 2x2+ x3 – s1= 20 Add artificial variablefor equality… 1x1– 2x2+ x3 – s1+ a1= 20
“Greater-Than”, use Big M Max Z = x1+ 2x2 + 2x3 – Ma1 – Ma2 = 0 s.t. 1x1– 2x2+ x3 – s1+ a1= 20 2x1 + 4x2+ x3+ + a2 = 50 x1 , x2,x3,s1 ,a1,a2 0 Tableau with reduced objective function:
Negative RHS’s 0.4x1– 0.3x2 – 10 Is exactly equivalent to Multiply by –1 – 0.4x1+ 0.3x2 10
Minimization Problems Min Z = 0.4x1+ 0.3x2 Is exactly equivalent to Multiply by –1 Max Z = – 0.4x1– 0.3x2
Decision variables with unconstrained sign When xj is allowed to be any value (+ or –) Substitute xj by 2 new variables: xj+ = max(0, xj ) (the “positive component” of xj) xj- = max(0, -xj ) (the “negative component” of xj) We now have: xj = xj+– xj – xj+ , xj – 0 The success of this method is due to the fact that in any CPF, at least one of these 2 variables is out of base (null)
Example Max Z = 3x1 + 2x2 + x3 s.t. x1 + x2 + x3 = 5 2x1 + x2 + x4 = 6 x1 , x2 , x4 0 x3 any sign Let x3+ = max(0, x3) (the “positive component” of x3) Let x3- = max(0, -x3) (the “negative component” of x3) Max Z = 3x1 + 2x2 + x3+ - x3- subject to x1 + x2 + x3+ - x3- = 5 2x1 + x2 + x4 = 6 Now all variables are positive and we have a standard LP.
Expressions with absolute value When the problem contains expressions with absolute value, such as |3xa + + 2xb- 3 | Let u = expression u+ = max(0, u) (the “positive component” of u) u- = max(0, -u) (the “negative component” of u) We now have: u= u+ - u– and |u| = u+ + u– The success of this method is due to the fact that in any CPF, at least one of these 2 variables is out of base (null)
Example Max Z = 3x1 + 2x2 +|3x1 + 2x2+ 2| s.t. x1 + x2 + x3 = 5 2x1 + x2 + x4 = 6 xi 0 Let u = 3x1 + 2x2 + 2 Let u+ = max(0, u) (the “positive component” of u) Let u- = max(0, -u) (the “negative component” of u) Max Z = 3x1 + 2x2 + u+ + u- subject to x1 + x2 + x3 = 5 2x1 + x2 + x4 = 6 -3x1 - 2x2 + u+ - u-= 2 We added the last expression to force the initial definition of u. Now all variables are positive and we have a standard LP.
Maximize the Minimum When the economic function has the shape of maximizing the minimum of several expressions, such as Maximize Min(3x1 + 2x2 , x1 - 2x3 ) Maximize z = u s.t. u ≤ 3x1 + 2x2 u ≤ x1 - 2x3 uis unconstrained in sign
LP Special Cases • Unbounded LPs • Unfeasible LPs • Alternate Optima
Unbounded Solutions • Pivot cell is zero • Can bring in unlimited x2 • Z increases without limit! • LP is “unbounded” 40/0= 120/0=
No Feasible Solutions An LP is infeasible if an artificial variableremains basic in the optimal solution
Alternate Optima There is alternate optima if in the final tableau, the coefficient of Z for a non-basic variable is Zero
x2 40 20 x1 30 40 Interior Point Solution Approach • Starts at feasible point • Moves through interior of feasible region • Always improves objective function • Theoretical interest