Вы находитесь на странице: 1из 22

Lecture 4 and 5 Material

Instructor: K. Gita Ayu March 28, 2012

1
1.1

Simplex
Review on Matrices and Systems of Linear Equations

Matrix mxn has m equations and n unknowns (variables) ERO (Elementary Row Operations) transforms a given matrix A into a new matrix A through one of the following operations: Type 1 ERO: A is obtained by multiplying any row of A by a nonzero scalar Type 2 ERO: begins by multiplying any row of A by a nonzero scalar c and for some jnei, let row j of A = c (row i of A) + row j of A, and let the other rows of A be the same as the rows of A Type 3 ERO: interchange any two rows of A Gauss-Jordan method solves a linear equation system by utilizing EROs. After applying the method: to a linear system and obtain a row of the form [0 0 . . . 0|c] (c = 0), then the original linear system has no solution. a variable that appears with a coecient of 1 in a single equation and 0 in all other equations is called a basic variable (BV). Any variable that is not a basic variable is called a nonbasic variable (NBV) A square matrix has an equal number of rows and columns The diagonal elements of a square matrix are those elements of ai j where i = j A square matrix for which all diagonal elements are equal to 1 and other elements are equal to 0 is called an identity matrix AA = I = AA Example: 2x + y + z 4x 6y 2x + 7y + 2z =5 = 2 =9 1 1 x1 5 6 0 x2 = 2 7 2 x3 9 1 1 6 0 7 2 5 x1 2 x2 9 x3 1

2 The equation in the matrix form is 4 2 2 The augmented matrix equation is 4 2

1.2

How to Convert an LP to Standard Form

Dene for each: constraint add a slack variable si (the amount of the resources unused in the ith constraint) and add the sign restriction si 0 constraint subtract a excess/surplus variable si (the amount by which the i-th constraint is oversatised and add the sign restriction si 0 if xj a, a > 0, write xj = xj a. Then xj a, i, xj 0. Replace all xj in the formulation by xj + a if xj is free (urs), create two new variables: uj 0 and wj 0 and set xj = uj wj

1.3

Preview of Simplex Algorithm

Suppose we have this LP: max (or min) z= s. t. c1 x1 + c2 x2 + + cn xn a11 x1 + a12 x2 + + a1n xn = b1 a21 x2 + a22 x2 + + a2n xn = b2 ... am1 x1 + am2 x2 + + amn xn = bm xi 0, (i = 1, 2, . . . , n)

Write in the matrix form, we get: Ax = b in which, a11 . . . a1n . .. . ,x = . . A= . . . am1 . . . amn

x1 . ,b = . . xn

b1 . . . bm

Now, consider a system Ax = b of m linear equations in n variables (assume n m)

Denition a basic solution to Ax = b is obtained by setting n m variables equal to 0 and solving for the values of the remaining m variables. This assumes that setting the n m variables equal to 0 yields unique variables for the remaining m variables or, equivalently, the column for the remaining m variables are linearly independent. Two variables: BV (basic variables) and NBV (non-basic variables, values = 0) It is possible to have no basic solution corresponding to a set of BV Denition any basic solution in which all variables are nonnegative is a basic feasible solution (bfs).

Theorem 1 The feasible region for any linear programming problem is a convex set. If an LP has an optimal solution, there must be an extreme point of the feasible region that is optimal.

Theorem 2 For any LP, there is a unique extreme point of the LPs feasible region corresponding to each basic feasible solution (bfs). Also, there is at least one bfs corresponding to each extreme point of the feasible region.

Combining the two theorems, to search for an optimal solution to an LP, just nd the best bfs (largest z-value for max and smallest z-value for min) to Ax = b. Denition for any LP with m constraints, two bfs are said to be adjacent if their sets of basic variables have (m 1) basic variables in common. The set of points satisfying a linear inequality in three (or any number of) dimensions is a half-space. Thus, a linear equation system with 5 constraints means the feasible region for such LP is the intersection of the ve half-spaces which is called a polyhedron.

General Description of Simplex Algorithm: 1. Find a bfs to the LP and lets call it the initial bfs. Set the current bfs = initial bfs 2. Determine whether the current bfs is an optimal solution to the LP. If not, nd an adjacent bfs that has a larger z-value 3. Set current bfs = new bfs. Return to step 2
n If an LP in standard form has m constraints and n variables, then the LP can have at most m basic solutions. Vast experience, the beauty of simplex algorithm is usually able to nd the optimal solution after examining fewer than 3m bfs.

1.4

Simplex Algorithm

Step 1 Convert the LP to standard form Step 2 Obtain a bfs (if possible) from the standard form Step 3 Determine whether the current bfs is optimal Step 4 If the current bfs is not optimal, determine which NBV should become a BV (entering variable) and which BV should become a NBV (leaving variable). Find a new bfs with a better z-value Step 5 Use EROs to nd the new bfs with the better objective function value. Go back to step 3 NOTE: write the objective function in the form of z c1 x1 c2 x2 . . . cn xn = 0 (row 0 version) Simplex algorithm can be performed in matrix algebra or simplex tableau form.

1.5

Giapettos Woodcarving Revisited

Giapettos Woodcarving, Inc., manufactures two types of wooden toys: soldiers and trains. A soldier sells for $27 and uses $10 worth of raw materials. Each soldier that is manufactured increases Giapettos variable labor and overhead costs by $14. A train sells for $21 and uses $9 worth of raw materials. Each train built increases Giapettos variable labor an overhead costs by $10. The manufacture of wooden soldiers and trains 3

requires two types of skilled labor: carpentry and nishing. A soldier requires 2 hours of nishing and 1 hour of carpentry labors. A train requires 1 hour of nishing and 1 hour of carpentry labor. Each week, Giapetto can obtain all the needed raw material but only 100 nishing hours and 80 carpentry hours. Demand for trains is unlimited, but at most 40 soldiers are bought each week. Giapetto wants to maximize weekly prot (revenue - cost). Formulate the mathematical model of Giapettos situation that can be used to maximize Giapettos weekly prot. Solution Decision variables: X1 = # soldiers produced each week X2 = # trains produced each week

max z =

3X1 + 2X2

(prot) (available nishing labor hour) (available carpentry labor hour) (at most 40 soldiers are bought each week) (nonnegative constraint)

s.t. 2X1 + X2 100 X1 + X2 80 X1 40 X1 , X2 0 Solve using Simplex (walkthrough) 1. Convert the LP to standard form:

z 3x1 2x2 2x1 + x2 + s1 x1 + x2 x1 + s2 + s3

= = = =

0 100 80 40

2. Set the BV = {s1 , s2 , s3 } and NBV = {x1 , x2 }. Thus, the bfs is (x1 , x2 , s1 , s2 , s3 ) = (0, 0, 100, 80, 40) which is equivalent to point (0, 0) with z = 0 3. Can we improve? Yes (a) Which variable will be the entering variable? The one that can increase z-value the most, which is x1 (the most negative coecient in row 0 for maximization problem). (b) Since x1 will enter the BV, which BV shall be the leaving variable? We want to make x1 as big as possible without allowing the other variables become negative (due to the nonnegative sign constraint) Set x2 = 0 as it is an NBV, we 2x1 + s1 = 100, thus s1 0, x1 + s2 = 80, thus s2 0, x1 + s3 = 40, thus s3 0, get: for x1 100/2 = 50 for x1 80 for x1 40

In order to not violating the nonnegative constraint, x1 can only be at most 40. Meaning, s3 leaves the basis This is called the RATIO TEST New bfs is (40, 0, 20, 40, 0), with BV = {s1 , s2 , x1 } and NBV = {s3 , x2 }

4. In order to make x1 becoming BV with a value of 40, its coecient has to be set equal to 1 on the third row and zeroes for the other rows (note: the denition of a BV). Thus, perform pivoting the third row use the ERO method, to get a revised LP: z 2x2 +x2 + s1 +x2 x1 5. Can we improve it still? Yes (a) Which variable will be the entering variable? The one that can increase z-value the most, which is x2 (the most negative coecient in row 0 for maximization problem). (b) Since x2 will enter the BV, which BV shall be the leaving variable? We want to make x2 as big as possible without allowing the other variables become negative (due to the nonnegative sign constraint) Set s3 = 0 as it is an NBV, we get: x2 + s1 = 20, thus s1 0, for x2 20 x2 + s2 = 40, thus s2 0, for x2 40 x1 = 40 In order to not violating the nonnegative constraint, x2 can only be at most 20. Meaning, s1 leaves the basis New bfs is (40, 20, 0, 20, 0), with BV = {x2 , s2 , x1 } and NBV = {s3 , s1 } 6. In order to make x2 becoming BV with a value of 20, its coecient has to be set equal to 1 on the third row and zeroes for the other rows (note: the denition of a BV). Thus, perform pivoting the third row use the ERO method, to get a revised LP: z + 2s1 +x2 + s1 x1 7. Can we improve it still? Yes (a) Which variable will be the entering variable? The one that can increase z-value the most, which is s3 (the most negative coecient in row 0 for maximization problem). (b) Since s3 will enter the BV, which BV shall be the leaving variable? We want to make s3 as big as possible without allowing the other variables become negative (due to the nonnegative sign constraint) Set s1 = 0 as it is an NBV, we get: x2 2s3 = 20, thus x2 0, for s3 20/2 = 10 s2 + s3 = 40, thus s2 0, for s3 20 x1 + s3 = 40, thus x1 0, for s3 40 s3 2s3 + s3 = = = = 160 20 40 40 + 3s3 2s3 + s2 s3 + s3 = = = = 120 20 40 40

s1 + s2 + s3

In order to not violating the nonnegative constraint, s3 can only be at most 20. Meaning, s2 leaves the basis New bfs is (20, 60, 20, 0, 0), with BV = {x2 , s3 , x1 } and NBV = {s2 , s1 } 8. In order to make s3 becoming BV with a value of 20, its coecient has to be set equal to 1 on the third row and zeroes for the other rows (note: the denition of a BV). Thus, perform pivoting the third row use the ERO method, to get a revised LP: z + s1 + s2 +x2 s1 + 2s2 s1 + s2 + s3 x1 + s1 + s2 = = = = 180 60 20 40

9. Can we improve it still? No, it is optimal already. Thus, the optimal solution is: z = 180, where x1 = 20 and x2 = 60 See the graph below to understand how simplex algorithm works. There is a relationship between the entering NBV and the constraint.By denition, binding constraint is a constraint where the lhs = rhs, meaning the slack/excess variables should be equals to zero.

Figure 1: Simplex Movement in Solving Giapettos Problem Moving from (0, 0) to the right (40, 0): x1 enters the basis and s3 leaves the basis (s3 represents the demand constraint becomes the binding constraint)

Moving from (40, 0) to point C(40, 20): x2 enters the basis and s1 leaves the basis (s1 represents the nishing constraint becomes the binding constraint) Moving from (40, 20) to point B(20, 60): s3 enters the basis and s2 leaves the basis (s2 represents the carpentry constraint becomes the binding constraint)

1.6

Dakota Problem (Winston, p. 140)

The Dakota Furniture Company manufactures desks, tables, and chairs. The manufacture of each type of furniture requires lumber and two types of skilled labor: nishing and carpentry. The amount of each resource needed to make each type of furniture is given in table below. At present, 48 board feet of lumber, 20 nishing hours, and 8 carpentry hours are available. A desk sells for $60, a table for $30, and a chair for $20. Dakota believes that demand for desks and chairs is unlimited, but at most ve tables can be sold. Since the available resources have already been purchased, Dakota wants to maximize total revenue. Resource Lumber Finishing hours Carpentry hours Solution Decision variables: X1 = # desks manufactured X2 = # tables manufactured X3 = # chairs manufactured max z = 60X1 + 30X2 + 20X3 (max board ft of lumber can be used) (available nishing hours) (available carpentry hours) (max 5 tables can be sold) (nonnegative constraint) Desk 8 board ft 4 hrs 2 hrs Table 6 board ft 2 hrs 1.5 hrs Chair 1 board ft 1.5 hrs .5 hr

s.t. 8X1 + 6X2 + X3 48 4X1 + 2X2 + 1.5X3 20 2X1 + 1.5X2 + .5X3 8 X2 5 X1 , X2 , X3 0 Solve using Simplex 1. Convert the LP to standard form: z 60x1 30x2 20x3 8x1 + 6x2

= = + s2 + s3 + s4 = = =

0 48 20 8 5

+ x3 + s1

4x1 + 2x2 + 1.5x3 2x1 + 1.5x2 + .5x3 x2

2. Set the BV = {s1 , s2 , s3 , s4 } and NBV = {x1 , x2 , x3 }. Thus, the bfs is (x1 , x2 , x3 , s1 , s2 , s3 , s4 ) = (0, 0, 0, 48, 20, 8, 5) which is equivalent to point (0, 0) with z = 0 3. Can we improve? Yes (a) Which variable will be the entering variable? The one that can increase z-value the most, which is x1 (the most negative coecient in row 0 for maximization problem).

(b) Since x1 will enter the BV, which BV shall be the leaving variable? We want to make x1 as big as possible without allowing the other variables become negative (due to the nonnegative sign constraint) Perform ratio test: x1 48/8 = 6 x1 20/4 = 5 x1 8/2 = 4* In order to not violating the nonnegative constraint, x1 can only be at most 4. Meaning, s3 leaves the basis (x1 enters) New BV = {s1 , s2 , x1 , s4 } and NBV = {s3 , x2 , x3 } with z = 240 and (4, 0, 0, 16, 4, 0, 5) 4. Pivoting the third row use the ERO method to get a revised LP in a tableau form z 1 0 0 0 0 5. Can we improve? Yes (a) Which variable will be the entering variable? The one that can increase z-value the most, which is x3 (the most negative coecient in row 0 for maximization problem). (b) Since x3 will enter the BV, which BV shall be the leaving variable? We want to make x3 as big as possible without allowing the other variables become negative (due to the nonnegative sign constraint) Perform ratio test: s1 = 16 + x3 , thus s1 0 for all values of x3 x3 4/.5 = 8* x1 4/.25 = 16 no ratio test because x3 has a nonpositive coecient in row 4 In order to not violating the nonnegative constraint, x3 can only be at most 8. Meaning, s2 leaves the basis (x3 enters) New BV = {s1 , x3 , x1 , s4 } and NBV = {s3 , x2 , s2 } 6. Pivoting the second row use the ERO method to get a revised LP in a tableau form z 1 0 0 0 0 x1 0 0 0 1 0 x2 x3 5 0 2 0 2 1 1.25 0 1 0 s1 s2 0 10 1 2 0 2 0 .5 0 0 s3 s4 10 0 8 0 4 0 1.5 0 0 1 rhs 280 24 8 2 5 BV z = 280 s1 = 24 x3 = 8 x1 = 24 s4 = 5 x1 0 0 0 1 0 x2 x3 s1 15 5 0 0 1 1 1 .5 0 .75 .25 0 1 0 0 s2 s3 s4 0 30 0 0 4 0 1 2 0 0 .5 0 0 0 1 rhs 240 16 4 4 5 BV z = 240 s1 = 16 s2 = 4 x1 = 4 s4 = 5

7. Can we improve? No. Thus, the optimal solution is: z = 280, where x1 = 2,x2 = 0, and x3 = 8. The optimal solution is (2, 0, 8, 24, 0, 0, 5).

1.7

Simplex Tableau Form


If we have the canonical form: z + 3x1 + x2 x1 2x1 + x2 + s1 + s2 =6 =4 =3

z 1 The simplex tableau form is: 0 0

x1 3 1 2

x2 1 0 1

s1 s2 0 0 1 0 0 1

rhs 6 4 3

BV z=6 s1 = 4 s2 = 3

Simplexs matrix form will be learnt during the sensitivity analysis lecture.

1.8

Simplex Minimization Problem

Assume we have: min s.t. z = 2x1 3x2 x1 + x2 x1 x2 x1 , x2 4 6 0

There are two ways to solve a minimization problem: Convert it into a maximization problem and solve it as usual. 1. Note that max f (x) = min f (x). Rewrite the problem above into a maximization problem: max s.t. z = 2x1 + 3x2 x1 + x2 x1 x2 x1 , x2 2. Solve it using simplex method: max s.t. z + 2x1 3x2 x1 + x2 + s1 x1 x2 3. Write it in tableau form: z 1 0 0 z 1 0 0 + s2 =0 =4 =6 4 6 0

x1 x2 s1 2 3 0 1 1 1 1 1 0 x1 5 1 2 x2 0 1 0

s2 rhs 0 0 0 4 1 6

BV ratio test z = 0 s1 = 4 4/1 = 4 s2 = 6 none BV ratio test z = 12 x2 = 4 s2 = 10

4. x2 enters the basis and s1 leaves the basis. Pivoting on the second row s1 s2 rhs 3 0 12 1 0 4 1 1 10 9

5. Optimal solution z = -12, where the bfs is (x1 , x2 , s1 , s2 ) = (0, 4, 0, 10) Solve it as a minimization problem directly 1. Solve it using simplex method: min s.t. z 2x1 + 3x2 x1 + x2 + s1 x1 x2 2. Write it in tableau form: z 1 0 0 x1 x2 s1 s2 rhs 2 3 0 0 0 1 1 1 0 4 1 1 0 1 6 BV ratio test z=0 s1 = 4 4/1 = 4 s2 = 6 none + s2 =0 =4 =6

3. x2 enters the basis and s1 leaves the basis. Pivoting on the second row z 1 0 0 x1 x2 5 0 1 1 2 0 s1 s2 3 0 1 0 1 1 rhs 12 4 10 BV ratio test z = 12 x2 = 4 s2 = 10

4. Optimal solution z = -12, where the bfs is (x1 , x2 , s1 , s2 ) = (0, 4, 0, 10)

1.9

Alternative Optimal Solutions

Remarks: 1. If there is no NBV with zero coecient in row 0 of the optimal tableau, then the LP has a unique optimal solution. 2. All BV should have a zero coecient in row 0 3. If NBV has a zero coecient in row 0 also and when you do one step further and you obtained the same zvalue, thus the LP has multiple optimal solutions. Example (Dakota revisited, Winston, p. 152) The Dakota Furniture Company manufactures desks, tables, and chairs. The manufacture of each type of furniture requires lumber and two types of skilled labor: nishing and carpentry. The amount of each resource needed to make each type of furniture is given in table below.At present, 48 board feet of lumber, 20 nishing hours, and 8 carpentry hours are available. A desk sells for $60, a table for $35, and a chair for $20. Dakota believes that demand for desks and chairs is unlimited, but at most ve tables can be sold. Since the available resources have already been purchased, Dakota wants to maximize total revenue. Resource Lumber Finishing hours Carpentry hours Solution Desk 8 board ft 4 hrs 2 hrs Table 6 board ft 2 hrs 1.5 hrs Chair 1 board ft 1.5 hrs .5 hr

10

Decision variables: X1 = # desks manufactured X2 = # tables manufactured X3 = # chairs manufactured max z = 60X1 + 35X2 + 20X3 (max board ft of lumber can be used) (available nishing hours) (available carpentry hours) (max 5 tables can be sold) (nonnegative constraint)

s.t. 8X1 + 6X2 + X3 48 4X1 + 2X2 + 1.5X3 20 2X1 + 1.5X2 + .5X3 8 X2 5 X1 , X2 , X3 0 Solve using Simplex 1. Convert the LP to standard form: z 60x1 35x2 20x3 8x1 + 6x2

= = + s2 + s3 + s4 = = =

0 48 20 8 5

+ x3 + s1

4x1 + 2x2 + 1.5x3 2x1 + 1.5x2 + .5x3 x2 2. Tableau form: z 1 0 0 0 0

x1 x2 x3 s1 s2 s3 s4 rhs 60 35 20 0 0 0 0 0 8 6 1 1 0 0 0 48 4 2 1.5 0 1 0 0 20 2 1.5 .5 0 0 1 0 8 0 1 0 0 0 0 1 5

BV s1 s2 s3 s4

ratio test

= 48 48/8 = 6 = 420 20/4 = 5 =8 8/2 = 4 =5 none

3. x1 enters the basis and s3 leaves the basis, pivoting on the 4th row: z 1 0 0 0 0 x1 0 0 0 1 0 x2 x3 s1 10 5 0 0 1 1 1 .5 0 .75 .25 0 1 0 0 s2 s3 s4 0 30 0 0 4 0 1 2 0 0 .5 0 0 0 1 rhs 240 16 4 4 5 BV z = 240 s1 = 16 s2 = 4 x1 = 4 s4 = 5 ratio test none 4/.5 = 8 4/.25 = 16 none

4. x3 enters the basis and s2 leaves the basis, pivoting on the third row: z 1 0 0 0 0 x1 0 0 0 1 0 x2 x3 0 0 2 0 2 1 1.25 0 1 0 s1 s2 0 10 1 2 0 2 0 .5 0 0 s3 s4 10 0 8 0 4 0 1.5 0 0 1 rhs 280 24 8 2 5

5. NBV (x2 ) has zero coecient in row 0 while all BV must have a zero coecient in row 0. Thus, what will happen if we enter x2 into the basis? x1 leaves the basis

11

z x1 x2 x3 s1 s2 s3 1 0 0 0 0 10 10 0 1.6 0 0 1 1.2 5.6 0 1.6 0 1 0 1.2 1.6 0 .8 1 0 0 .4 1.2 0 .8 0 0 0 .4 1.2 6. Same z-value, thus we have 2 optimal solutions

s4 0 0 0 0 1

rhs 280 27.2 11.2 1.6 3.4

BV z = 280 s1 = 27.2 x3 = 11.2 x2 = 1.6 s4 = 3.4

1.10

Unbounded LP

Example (Breadco Bakeries, Winston, p. 154) Breadco Bakeries bakes two kinds of bread: French and sourdough. Each loaf of French bread can be sold for 36, and each loaf of sourdough bread for 30. A loaf of French bread requires 1 yeast packet and 6 oz. of our; sourdough requires 1 yeast packet and 5 oz. of our. At present, Breadco has 5 yeast packets and 10 o.z of our. Additional yeast packets can be purchased at 3 each, and additional our at 4/oz. Formulate and solve an LP that can be used to maximize Breadcos prot! Solution Decision variables: X1 X2 X3 X4 = = = = # # # # loaves of French bread sold loaves of sourdough bread sold packets of yeast purchased oz. of our purchased 36X1 + 30X2 3X3 4X4 s.t. X1 + X2 X3 5 X4 10 (available yeast) (available our) (nonnegative constraint) 6X1 + X2

max z =

X1 , X2 , X3 , X4 0 Solve using Simplex 1. Convert the LP to standard form: z 36x1 30x2 3x3 4x4 x1 + x2 6x1 + x2 2. Tableau form: z 1 0 0 x1 x2 x3 x4 s1 s2 rhs 36 30 3 4 0 0 0 1 1 1 0 1 0 5 6 5 0 1 0 1 10 x3 x4

= + s1 + s2 = =

0 5 10

BV ratio test z=0 s1 = 5 5/1 = 5 5 s2 = 10 10/6 = 3

3. x1 enters the basis and s2 leaves the basis, pivoting on the third row: z 1 0 0 x1 0 0 1 x2 0
1 6 5 6

x3 3 1 0

x4 2
1 6 1 6

s1 0 1 0

s2 rhs 6 60 1 10 6 3
1 6 5 3

BV z = 60 s1 = 10 3 x1 = 5 3

ratio test ( 10 )/( 1 ) = 20 3 6 none

12

4. x4 enters the basis and s1 leaves the basis, pivoting on the second row: z 1 0 0 Remarks: 1. We would like to enter one variable, x3 , however the ratio test fail because increasing x3 will result in an increase in both x4 and x1 , thus the LP is unbounded. 2. Unbounded LP is commonly occur due to the modeling. 3. In the Breadco Bakeries, the unlimited purchase and demand are not plausible. This is the cause of the unbounded LP. 4. An unbounded LP has a tableau in which a NBV has a negative coecient in row 0 and a nonpositive coecient in each constraint x1 0 0 1 x2 2 1 1 x3 9 6 1 x4 0 1 0 s1 12 6 1 s2 rhs 4 100 1 20 0 5 BV ratio test z = 100 x4 = 20 none x1 = 5 none

1.11

Degenerate LP

Nondegenerate LP property states that in each of the bfs, all of the BV are positive (meaning > 0). Degenerate LP property: an LP with at least one bfs in which a BV is equal to zero. Cycling is the occurrence where we encounter the same bfs twice.

13

Two-Phased Simplex

Step 1 Modify the constraints so that the rhs of constraint is nonnegative. This requires that each constraint with a negative rhs be multiplied through by 1 Step 1 Identify each constraint that is now an = or constraint. In step 3, we will add an articial variable to each constraint Step 2 Convert each inequality constraint to the standard form. If constraint i is a constraint, then add a slack variable and if constraint i is a constraint, subtract an excess variable Step 3 If (after step 1) constraint i is a or = constraint, add an articial variable ai . Also add the sign restriction ai 0 Step 4 For now, ignore the original LPs objective function. Instead solve an LP with objective function is min w = (sum of all the articial variables). This is called the Phase I Simplex. The act of solving the Phase I will force the articial variables to be zero Because each ai 0, solving the Phase I LP will result in one of the following three cases: Case 1 The optimal value of w > 0, thus the original LP has no feasible solution Case 2 The optimal value of w = 0 and no articial variables are in the optimal Phase I basis, then 1. Drop all columns with articial variables 2. Combine the original objective function with the constraints from the optimal Phase I 3. Start Phase II LP 4. The solution of Phase II LP is the optimal solution to the original problem Case 3 The optimal value of w = 0 and at least 1 articial variable is in the optimal Phase I basis, then 1. Drop from the optimal Phase I tableau all NBV articial variables and any variable from the original problem that has a negative coecient in row 0 of the optimal Phase I tableau 2. Start Phase II LP 3. The solution of Phase II LP is the optimal solution to the problem Example 1 Solve the following LP.

14

15

Example 2 (Bevco, Winston, p. 172) Bevco manufactures an orange-avored soft drink called Oranj by combining orange soda and orange juice. Each ounce of orange soda contains .5 oz of sugar and 1 mg of vitamin C. Each ounce of orange juice contains .25 oz of sugar and 3 mg of vitamin C. It costs Bevco 2 to produce an ounce of orange soda and 3 to produce an ounce of orange juice. Bevcos marketing department has decided that each 10-oz bottle of Oranj must contain at least 20 mg of vitamin C and at most 4 oz of sugar. Use linear programming to determine how Bevco can meet the marketing departments requirements at minimum cost. Solution Let: x1 = # of ounces of orange soda in a bottle of Oranj x2 = # of ounces of orange juices in a bottle of Oranj

16

min z = s.t.

2x1 + 3x2
1 2 x1

+ 1 x2 4

4 20 = 10 0

(sugar) (vitamin C) (10-oz bottle of Oranj)

x1 + 3x2 x1 + x2 x1 , x2

1. Convert into the LP standard form by adding slack variables z 2x1 1 2 x1 x1 x1 3x2 1 + 4 x2 +3x2 +x2 = 0 = 4 = 20 = 10

+s1 s2

2. Each constraint shall be represented by a BV, thus we need to have three BV to create the initial bfs. Unfortunately, only s1 could be used as a BV because it does not violate the sign restriction (all variables non-negative). To remedy this problem, we add a basic feasible variable for each constraint that needs one, which is called as articial variable. z 2x1 1 2 x1 x1 x1 3x2 1 + 4 x2 +3x2 +x2 = 0 = 4 = 20 = 10

+s1 s2 +a2 +a3

3. Adding articial variable changes the model which results in nding the optimal solution that may not be the optimal solution for the original LP, but this will not be the case if all articial variables are zeroes. Thus, we begin Phase I Simplex with goal of minimizing the sum of all articial variables: min w = a2 + a3 which can be rewritten as: w
1 2 x1 x1

a2 + 1 x2 4 +3x2 +x2 +s1 s2 +a2

a3

x1

+a3

= 0 = 4 = 20 = 10

4. Note that row 0 for Phase I contains BV which has to be eliminated. To eliminate a2 and a3 , simply add constraint 2 and 3 to row 0 to get: w + 2x1 + 4x2 s2 = 30 5. Combining the new row 0 with the Phase I constraint yields the initial Phase I tableau as follow. Begin the simplex method by nding the entering variable (the most positive, x2 ) and the leaving variable by performing ratio test (a2 ) w 1 0 0 0 x1 x2 2 4
1 2 1 4

1 1

3 1

s1 0 1 0 0

s2 a2 1 0 0 0 1 1 0 0

a3 rhs 0 30 0 4 0 20 1 10

BV ratio test w = 30 s1 = 4 16 a2 = 20 20 3 a3 = 10 10

6. Upon pivoting in row 2, we nd the new entering variable (the most positive, x1 ) and the leaving variable based on the ratio test (a3 ). 17

w 1 0 0 0

x1
2 3 5 12 1 3 2 3

x2 0 0 1 0

s1 0 1 0 0

s2
1 3 1 12 1 3 1 3

a2 4 3
1 12 1 3

a3 0 0 0 1

rhs
10 3 7 3 20 3 10 3

BV w= s1 = x2 = a3 =

ratio test
10 3 7 3 20 3 10 3 28 5

20 5

1 3

7. Upon pivoting in row 3, we found the optimal solution for Phase I (w = 0). w 1 0 0 0 x1 x2 0 0 0 0 1 0 1 0 s1 0 s2 0 a2 1
1 8 1 2 1 2

a3 1 5 8 1 2
3 2

rhs 0
1 4

BV w=0 s1 =
1 4

ratio test

1 1 8 0 1 2 0
1 2

5 5

x2 = 5 x1 = 5

8. Begin Phase II with the following set of equations (original objective function and the constraints obtained from Phase I without the articial variable columns - a2 and a3 ). z 1 0 0 0 x1 2 0 0 1 x2 3 0 1 0 s1 0 s2 rhs 0 0
1 4

BV z=0 s1 =
1 4

ratio test

1 1 8
1 0 2

5 5

x2 = 5 x1 = 5

1 2

9. Because x1 and x2 are both in the optimal Phase I basis, they must be eliminated from the Phase II row 0. Add 3 (row 2) + 2 (row 3) to the row 0 in Phase to to get the new zrow. 1 z s2 = 25 2 10. Now begin Phase II with the following set of equations: z 1 0 0 0 x1 0 0 0 1 x2 0 0 1 0 s1 s2 0 1 2 1 1 8 0 1 2 0
1 2

rhs 25
1 4

BV z = 25 s1 =
1 4

ratio test

5 5

x2 = 5 x1 = 5

11. This is optimal (objective function is minimization and no variable is attractive because all variables have values of 0). In summary, the optimal solution for the Bevco problem is z = 25, x1 = x2 = 5, s1 = 1 , and s2 = 0. 4

18

Big M Method

Step 1 Modify the constraints so that the rhs of constraint is nonnegative. This requires that each constraint with a negative rhs be multiplied through by 1 Step 1 Identify each constraint that is now an = or constraint. In step 3, we will add an articial variable to each constraint Step 2 Convert each inequality constraint to the standard form. If constraint i is a constraint, then add a slack variable and if constraint i is a constraint, subtract an excess variable Step 3 If (after step 1) constraint i is a or = constraint, add an articial variable ai . Also add the sign restriction ai 0 Step 4 Let M denote a very large positive number. If the LP is a min problem, add (for each articial variable) M ai to the objective function If the LP is a max problem, add (for each articial variable) M ai to the objective function Step 5 Because each articial variable will be in the starting basis, all articial variables must be eliminated from row 0 before beginning the simplex. Step 6 Solve using simplex If all articial variables = 0 in the optimal solution, then we have found the optimal solution to the original problem If any articial variables are positive in the optimal solution, then the original problem is infeasible

Revisit example 1

Solve it using Big M Method.

19

20

This is the optimal tableau, with optimal solution x = (4, 1, 2) and optimal objective value z = 11

Revisit example 2

Solve it using Big M Method.

1. Convert into the LP standard form by adding slack variables z 2x1 1 2 x1 x1 x1 3x2 1 + 4 x2 +3x2 +x2 = 0 = 4 = 20 = 10

+s1 s2

2. Each constraint shall be represented by a BV, thus we need to have three BV to create the initial bfs. Unfortunately, only s1 could be used as a BV because it does not violate the sign restriction (all variables non-negative). To remedy this problem, we add a basic feasible variable for each constraint that needs one, which is called as articial variable. z 2x1 1 2 x1 x1 x1 3x2 1 + 4 x2 +3x2 +x2 = 0 = 4 = 20 = 10

+s1 s2 +a2 +a3

3. Adding articial variable changes the model which results in nding the optimal solution that may not be the optimal solution for the original LP, but this will not be the case if all articial variables are zeroes. Thus, we have to force all articial variables to be inattractive (add a term M ai to minimization or M ai for maximization problem) to the objective function: min z = 2x1 + 3x2 + M a2 + M a3 or can be rewritten as min z 2x1 3x2 M a2 M a3 = 0 4. Modifying the objective function in this way makes it extremely costly for an articial variable to be positive, meaning the optimal solution will have a2 = a3 = 0. Note that row 0 contains coecient for some BV which have to be eliminated. To eliminate a2 and a3 , simply add M (row 2) + M (row 3) to change row 0 to: z + (2M 2)x1 + (4M 3)x2 M s2 = 30M 5. Combining the new row 0 with the constraint yields the initial Big M tableau as follow. Begin the simplex method by nding the entering variable (the most positive, x2 ) and the leaving variable by performing ratio test (a2 ) z 1 0 0 0 x1 2M 2
1 2

x2 4M 3

1 1

s1 0 1 1 4 3 0 1 0

s2 a2 M 0 0 0 1 1 0 0 21

a3 rhs 0 30M 0 4 0 20 1 10

BV ratio test z = 30 s1 = 4 16 a2 = 20 20 3 a3 = 10 10

6. Upon pivoting in row 2, we nd the new entering variable (the most positive, x1 ) and the leaving variable based on the ratio test (a3 ). z 1 0 0 0 x1
2M 3 3 5 12 1 3 2 3

x2 0 0 1 0

s1 0 1 0 0

s2
M 3 3 1 12

a2
34M 3 1 12 1 3 1 3

a3 0 0 0 1

rhs
60+10M 3 7 3 20 3 10 3

BV z=
60+10M 3 7 3 20 3 10 3

ratio test

s1 = x2 = a3 =

28 5

1 3
1 3

20 5

7. Upon pivoting in row 3, we found the optimal solution. Objective function is a minimization and all variables are 0. z 1 0 0 0 x1 0 0 0 1 x2 0 0 1 0 s1 s2 1 0 2
1 1 8

a2 12M 2
1 8 1 2

a3 32M 2
5 8 1 2 3 2

rhs 25
1 4

BV z = 25 s1 =
1 4

ratio test

0 1 2 0
1 2

5 5

x2 = 5 x1 = 5

1 2

1 8. In summary, the optimal solution for the Bevco problem is z = 25, x1 = x2 = 5, s1 = 4 , and s2 = 0.

22

Вам также может понравиться