1 chapter 4 the simplex algorithm part 2 prof. dr. m. arslan Örnek

59
1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

Upload: rolf-fitzgerald

Post on 20-Jan-2016

221 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

1

Chapter 4The Simplex Algorithm

PART 2Prof. Dr. M. Arslan ÖRNEK

Page 2: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

2

Page 3: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

3ISE203/IE251

Page 4: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

4ISE203/IE251

Page 5: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

5ISE203/IE251

Page 6: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

6ISE203/IE251

Page 7: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

7ISE203/IE251

Page 8: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

8ISE203/IE251

Page 9: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

9ISE203/IE251

Page 10: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

10ISE203/IE251

Page 11: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

11ISE203/IE251

Page 12: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

12ISE203/IE251

Page 13: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

13ISE203/IE251

Page 14: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

14ISE203/IE251

Page 15: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

15ISE203/IE251

Page 16: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

16ISE203/IE251

Page 17: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

17ISE203/IE251

Page 18: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

18ISE203/IE251

Page 19: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

19

4.6 – The Simplex Algorithm (min LPs)

Two different ways the simplex method can be used to solve minimization problems.

min z = 2x1 – 3x2

s.t. x1 + x2 ≤ 4

x1 – x2 ≤ 6

x1, x2 ≥ 0

max -z = -2x1 + 3x2

s.t. x1 + x2 ≤ 4

x1 – x2 ≤ 6

x1, x2 ≥ 0

Method 1

Page 20: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

20

4.6 – The Simplex Algorithm (min LPs)Use –z as the basic variable in row 0.

Initial TableauRow - z x1 x2 s1 s2 rhs BVs

0 1 2 -3 0 0 0 - z = 01 0 1 1 1 0 4 s1 =42 0 1 -1 0 1 6 s2 = 6

ero1 - z x1 x2 s1 s2 rhs0 1 2 -3 0 0 01 0 1 1 1 0 42 0 2 0 1 1 10

ero 2 - z x1 x2 s1 s2 rhs BVs0 1 5 0 3 0 12 - z = 121 0 1 1 1 0 4 x2 = 42 0 2 0 1 1 10 s2 = 10

Page 21: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

21

4.6 – The Simplex Algorithm (min LPs)

The optimal solution (to the max problem) is -z = 12, x2 = 4, s2 = 10, x1 = s1 = 0.

Then the optimal solution to the min problem is z = -12, x2=4, s2 = 10, x1 = s2 = 0. z = 2x1-3x2 =2(0) – 3 (4) = -12.

In summary, multiply the objective function for the min problem by -1 and solve the problem as a maximization problem with the objective function –z. (optimal z-value for the min problem) = - (optimal z-value for the max problem).

Page 22: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

22

4.6 – The Simplex Algorithm (min LPs)

Method 2

A simple modification of the simplex algorithm can be used to solve min problems directly.

Modify Step 3 of the simplex algorithm as follows:

If all nonbasic variables (NBV) in row 0 have nonpositive coefficients, the current bfs is optimal.

If any nonbasic variable has a positive coefficient, choose the variable with the “most positive” coefficient in row 0 as the entering variable.

Page 23: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

23

4.7 – Alternative Optimal solutions

If an LP has more than one optimal solution, it has multiple optimal solutions.

If all nonbasic variables (NBV) have nonzero coefficients in row 0 of the optimal tableau, the LP has a unique optimal solution.

Otherwise, the LP may have alternative optimal solutions.

Page 24: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

24ISE203/IE251

Page 25: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

25

Page 26: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

26

4.8 – Unbounded LPs

An unbounded LP occurs in a max problem if There is a nonbasic variable with a negative coefficient in row 0

and There is no constraint that limits how large we can make this

NBV.

An unbounded LP for a max problem occurs when a variable with a negative coefficient in row 0 has a nonpositive coefficient in each constraint.

Page 27: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

27ISE203/IE251

Page 28: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

28

Example 3: Breadco Bakeries-An Unbounded LP

Page 29: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

29

Solution:

Page 30: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

30

Page 31: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

31

Page 32: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

32

4.11 Degeneracy and the Convergence of the Simplex Algorithm

Theoretically, the simplex algorithm can fail to find an optimal solution to an LP.

The following are facts (for Max LP):– If (value of entering variable in new bfs) > 0, then (z-value for

new bfs) > (z-value for current bfs).– If (value of entering variable in new bfs) = 0, then (z-value for

new bfs) = (z-value for current bfs). Up to now, we have seen that in each of the LP’s BFS, all

basic variables are positive.

Page 33: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

33

An LP with this property is a nondegenerate LP. An LP is degenerate if it has at least one bfs in which

a basic variable is equal to zero. Any bfs that has at least one basic variable equal to

zero is a degenerate bfs. When the same bfs is encountered twice it is called

cycling (looping).– If cycling occurs, then we will loop, or cycle, forever among

a set of basic feasible solutions and never get to an optimal solution.

Page 34: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

34ISE203/IE251

Page 35: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

35

4.12 The Big M Method

The simplex algorithm requires a starting (initial) bfs.

Previous problems have found starting bfs by using the slack variables as our basic variables.– If an LP have ≥ or = constraints, however, a starting bfs

cannot be found easily. In such a case, the Big M method is used to obtain a

starting bfs and solve the problem.

Page 36: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

36

Example 4: Bevco (A Blending Problem)

Bevco manufactures an orange-flavored soft drink called Oranj by combining orange soda and orange juice. – Each oz of orange soda contains 0.5 oz of sugar and 1 mg of vitamin C. – Each oz of orange juice contains 0.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. – Bevco’s 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 department’s requirements at minimum cost.

Page 37: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

37

Letting x1 = number of ounces of orange soda in a bottle of Oranj

x2 = number of ounces of orange juice in a bottle of Oranj

The LP is:

min z = 2x1 + 3x2

st 0.5x1 + 0.25x2 ≤ 4 (sugar constraint)

x1 + 3x2 ≥ 20 (Vitamin C constraint)

x1 + x2 = 10 (10 oz in 1 bottle of Oranj)

x1, x2, ≥ 0

Example 4: Bevco

Page 38: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

38

4.10 – The Big M MethodRow 0: z - 2x1 - 3x2 = 0

Row 1: 0.5x1 + 0.25x2 + s1 = 4

Row 2: x1 + 3x2 - e2 = 20

Row 3: x1 + x2 = 10

What will be the BV in row 2? Row 3?

Row 2 would violate sign restrictions

Row 3 no readily apparent basic variable.

To find a bfs, we create artificial variables. The variables will be labeled according to the row in which they are used.

Row 1: z - 2x1 - 3x2 = 0

Row 2: 0.5x1 + 0.25x2 + s1 = 4

Row 3: x1 + 3x2 - e2 + a2 = 20

Row 4: x1 + x2 + a3 = 10

Page 39: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

39

4.10 – The Big M Method

In the optimal solution, all artificial variables must be equal to zero. To accomplish this, in a min LP, a term +Mai is added to the objective function for each ai. For a max LP, the term –Mai is added to the objective function for each ai. M represents some very large number.

The modified Bevco LP in standard form then becomes:

Row 0: z - 2x1 - 3x2 -Ma2 - Ma3 = 0

Row 1: 0.5x1 + 0.25x2 + s1 = 4

Row 2: x1 + 3x2 - e2 + a2 = 20

Row 3: x1 + x2 + a3 = 10

Modifying the objective function this way makes it extremely costly for an artificial variable to be positive. The optimal solution should force a2 = a3 =0.

Page 40: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

40

4.10 – The Big M MethodDescription of the Big M Method:

1. Modify the constraints so that the rhs of each constraint is nonnegative.

2. Convert each inequality constraint to standard form (add a slack variable for ≤ constraints, add an excess variable for ≥ constraints).

3. For each ≥ or = constraint, add artificial variables. Add sign restriction ai ≥ 0.

4. Let M denote a very large positive number. Add (for each artificial variable) Mai to min problem objective functions or -Mai to max problem objective function.

5. Since each artificial variable will be in the starting basis, all artificial variables must be eliminated from row 0 before beginning the simplex.

Page 41: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

41

4.10 – The Big M Method

If all artificial variables in the optimal solution equal zero, the solution is optimal. If any artificial variables are positive in the optimal solution, the problem is infeasible.

The Bevco example continued:

Initial Tableau

Row z x1 x2 s1 e2 a2 a3 rhs0 1.00 -2.00 -3.00 -M -M 0.001 0.50 0.25 1.00 4.002 1.00 3.00 -1.00 1.00 20.003 1.00 1.00 1.00 10.00

Page 42: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

42

4.10 – The Big M MethodPivot 1 z x1 x2 s1 e2 a2 a3 rhs ratio ero

0 1,00 2m - 2 4M -3 -M 30M Row 0 + M(Row 2) + M(Row 3)

1 0,50 0,25 1,00 4,00 162 1,00 3 -1,00 1,00 20,00 6,673 1,00 1,00 1,00 10,00 10

ero 1 z x1 x2 s1 e2 a2 a3 rhs ero0 1,00 2m - 2 4M -3 -M 30M 1 0,50 0,25 1,00 4,002 0,33 1 -0,33 0,33 6,67 Row 2 divided by 33 1,00 1,00 1,00 10,00

ero 2 z x1 x2 s1 e2 a2 a3 rhs ero0 1,00 (2M-3)/3 (M-3)/3 (3-4M)/3 (60+10M)/3 Row 0 - (4M-3)*(Row 2)1 0,50 0,25 1,00 4,002 0,33 1 -0,33 0,33 6,673 1,00 1,00 1,00 10,00

ero 3 z x1 x2 s1 e2 a2 a3 rhs ero0 1,00 (2M-3)/3 (M-3)/3 (3-4M)/3 (60+10M)/3 1 0,42 1,00 0,08 -0,08 2,33 Row 1 - 0.25*(Row 2)2 0,33 1 -0,33 0,33 6,673 1,00 1,00 1,00 10,00

ero 4 z x1 x2 s1 e2 a2 a3 rhs ero0 1,00 (2M-3)/3 (M-3)/3 (3-4M)/3 (60+10M)/31 0,42 1,00 0,08 -0,08 2,332 0,33 1 -0,33 0,33 6,673 0,67 0,33 -0,33 1,00 3,33 Row 3 - Row 2

Page 43: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

43

4.10 – The Big M Method

Pivot 2 z x1 x2 s1 e2 a2 a3 rhs ratio0 1.00 (2M-3)/3 (M-3)/3 (3-4M)/3 (60+10M)/31 0.42 1.00 0.08 -0.08 2.33 5.602 0.33 1 -0.33 0.33 6.67 20.003 0.67 0.33 -0.33 1.00 3.33 5.00

ero 1 z x1 x2 s1 e2 a2 a3 rhs ero0 1.00 (2M-3)/3 (M-3)/3 (3-4M)/3 (60+10M)/31 0.42 1.00 0.08 -0.08 2.332 0.33 1 -0.33 0.33 6.673 1.00 0.50 -0.50 1.50 5.00 (Row 3)*(3/2)

ero 2 z x1 x2 s1 e2 a2 a3 rhs ero0 1.00 -0.50 (1-2M)/2 (3-2M)/2 25.00 Row 0 + (3-2M)*(Row 3)/31 0.42 1.00 0.08 -0.08 2.332 0.33 1.00 -0.33 0.33 6.673 1.00 0.50 -0.50 1.50 5.00

ero 3 z x1 x2 s1 e2 a2 a3 rhs ero0 1.00 -0.50 (1-2M)/2 (3-2M)/2 25.001 1.00 -0.13 0.13 -0.63 0.25 Row 1 - (5/12)*Row 3)2 0.33 1.00 -0.33 0.33 6.673 1.00 0.50 -0.50 1.50 5.00

ero 4 z x1 x2 s1 e2 a2 a3 rhs ero0 1.00 -0.50 (1-2M)/2 (3-2M)/2 25.001 1.00 -0.13 0.13 -0.63 0.252 1.00 -0.50 0.50 -0.50 5.00 Row 2 -(1/3)*Row 33 1.00 0.50 -0.50 1.50 5.00

Optimal Solution

Page 44: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

44

Wyndor Problem - modified

ISE203/IE251

Page 45: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

45

Nonzero coefficient of x5 in the objective

function row.

We should make it zero.

ISE203/IE251

Page 46: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

46ISE203/IE251

Page 47: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

47ISE203/IE251

Page 48: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

48ISE203/IE251

Page 49: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

49ISE203/IE251

Page 50: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

50ISE203/IE251

Page 51: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

51ISE203/IE251

Page 52: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

52ISE203/IE251

Page 53: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

53ISE203/IE251

Page 54: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

54

4.14 Unrestricted-in-Sign Variables

If some variables are allowed to be unrestricted in sign (urs), the ratio test and therefore the simplex algorithm are no longer valid.

An LP with an unrestricted-in-sign variable can be transformed into an LP in which all variables are non-negative.– For each urs variable xi, define two new variables x+

i and x-i.

– Then substitute ( x +i - x -

i ) for xi in each constraint and in the objective function.

– Also add the sign restrictions.

Page 55: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

55

So we express xi as the difference of the two nonnegative

variables x+i and x-

i. No basic feasible solution can have both x+

i ≥ 0 and x-i ≥ 0.

x+i and x-

i will never be both basic variables. – The column of one is equal to the negative column of the other

For any basic feasible solution, each urs variable xi must fall into one of the following three cases.1. x+

i > 0 and x-i = 0

2. x+i = 0 and x-

i > 0

3. x+i = x-

i = 0

Page 56: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

56

Example 8 (Using urs Variables):

Page 57: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

57

Solution:

Page 58: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

58

Page 59: 1 Chapter 4 The Simplex Algorithm PART 2 Prof. Dr. M. Arslan ÖRNEK

59