Simplex Method for solving LP problems with two variables.

35
Simplex Method Simplex Method for solving LP problems for solving LP problems with two variables with two variables

Transcript of Simplex Method for solving LP problems with two variables.

Page 1: Simplex Method for solving LP problems with two variables.

Simplex MethodSimplex Method for solving LP problems for solving LP problems with two variableswith two variables

Page 2: Simplex Method for solving LP problems with two variables.

1- Introduction Graphical method presented in last chapter is fine for 2

variables. But most LP problems are too complex for simple graphical procedures.

The Simplex Method:o is appropriate for problems with more than 2 variables;o uses algebra rules, to find optimal solutions; o is an algorithm and is a series of steps that will

accomplish a certain task.

In this chapter will introduce the simplex method for problems with 2 variables.

Page 3: Simplex Method for solving LP problems with two variables.

2- Simplex algorithm through an example:

Assume one company producing flair furniture: Tables (T) and Chairs (C). The following table provides the information available:

Department

Production Available

Working

Hours

Tables Chairs

Carpentry 4 3 240

Painting & varnishing

2 1 100

Profit 7SR 5SR  

Page 4: Simplex Method for solving LP problems with two variables.

Formulation:

• Decision variables:T = Number of tablesC = Number of chairs

• Objective function:Maximize Z = 7T + 5C

• Constraints:2T + 1C 100 (Painting & varnishing) 4T + 3C 240 (Carpentry)T, C 0 (non-negativity constraints)

Page 5: Simplex Method for solving LP problems with two variables.

Graphical method solutionN

um

ber

of

Ch

airs 100

80

60

40

20

0 20 40 60 80 100 T

C

Number of Tables

FeasibleRegion

4T + 3C

2T + 1C

Optimal Solution:

T=30, C=40 Z= 410 SR

Page 6: Simplex Method for solving LP problems with two variables.

11stst Step: Step: Built initial Simplex tableau Less-than-or-equal-to constraints (≤) are converted

to equations by adding a variable called “slack variable”.

o Slack variables represent unused resources.

For the flair furniture problem, define the slacks as:o S1 = unused hours in the painting department

o S2 = unused hours in the carpentry department

The constraints are now written as:o 2T + 1C + S1 = 100

o 4T + 3C + S2 = 240

Page 7: Simplex Method for solving LP problems with two variables.

Slack variables not appearing in an equation are added with a coefficient of 0.This allows all the variables to be monitored at all times.

The final Simplex equations appear as:o 2T + 1C + 1S1 + 0S2 = 100

o 4T + 3C + 0S1 + 1S2 = 240

o T, C, S1, S2 0

The slacks are added to the objective coefficient with 0 profit coefficients. The objective function, then, is: Max. Z= 7T + 5C + 0S1 + 0S2

11stst Step, continued Step, continued

Page 8: Simplex Method for solving LP problems with two variables.

Initial Simplex tableau

T C S1 S2 Quantity (Q)

S1 2 1 1 0 100

S2 4 3 0 1 240

Z 7 5 0 0 0

We start by a basic solution Z=0.

Non-Basic variables

Bas

ic

vari

able

s

Page 9: Simplex Method for solving LP problems with two variables.

22ndnd Step: Step: Entering variable

Choose one entering variable from non-basic variables (T or C) for which we have the largest positive coefficient in the objective function. Here the entering variable will be T and the corresponding column is called pivot column.

T C S1 S2 Quantity (Q)

S1 2 1 1 0 100S2 4 3 0 1 240Z 7 5 0 0 0

Pivot column

Page 10: Simplex Method for solving LP problems with two variables.

33rd rd Step: Step: Leaving variable

Choose one leaving variable from the basic variables (S1 or S2) for which we have the smallest value of quantities (Q) divided by items of pivot column:

for S1 we have 100/2=50for S2 we have 240/4=60

Then the leaving variable will be S1 and the corresponding row is called pivot row.

Page 11: Simplex Method for solving LP problems with two variables.

33rd rd Step: Step: Leaving variable

T C S1 S2 (Q)

S1 2 1 1 0 100S2 4 3 0 1 240Z 7 5 0 0 0

Pivot column

Pivot row

Pivot item

Page 12: Simplex Method for solving LP problems with two variables.

44th th Step: Step: Pivoting

The pivoting is the changing of simplex tableau values as follow:

The entering variable (T) takes the place of leaving variable (S1).

All items of pivot column are =0 except pivot item =1.All items of pivot row are divided by pivot item.Other items of the tableau are calculated as follow:

A B

C D

Pivot column

Pivot rowNew A = A – B*C/D

Page 13: Simplex Method for solving LP problems with two variables.

44th th Step: Step: Pivoting

The New value of the objective function is calculated as follow:

Capacity of pivot rowZ’ = Z + Largest coefficient * Pivot item

If all coefficients of objective function are negatives or equal to zero the optimal solution is found. Otherwise go to step2.

Page 14: Simplex Method for solving LP problems with two variables.

44th th Step: Step: Pivoting

T C S1 S2 Q

S1 2 1 1 0 100S2 4 3 0 1 240

Z 7 5 0 0 0

Pivot column

Pivot row

Pivot item

Pivoting

Page 15: Simplex Method for solving LP problems with two variables.

44th th Step: Step: Pivoting

All coefficients of objective function aren’t negatives or equal to zero, the optimal solution is not found. Then go to step2.

T C S1 S2 Q

T 1 1/2 1/2 0 50S2 0 1 -2 1 40Z 0 3/2 -7/2 0 350

Page 16: Simplex Method for solving LP problems with two variables.

22ndnd Step: Step: Entering variable

The new largest positive coefficient in the objective function is 3/2 then the entering variable will be C.

33rd rd Step: Step: Leaving variable

The new smallest value of quantities (Q) divided by items of pivot column is 40/1=40 then the leaving variable will be S2 .

Page 17: Simplex Method for solving LP problems with two variables.

44th th Step: Step: Pivoting

T C S1 S2 QT 1 1/2 1/2 0 50S2 0 1 -2 1 40Z 0 3/2 -7/2 0 350

Pivot column

Pivot row

Pivot item

Page 18: Simplex Method for solving LP problems with two variables.

44th th Step: Step: Pivoting

T C S1 S2 QT 1 0 3/2 -1/2 30C 0 1 -2 1 40Z 0 0 -1/2 -3/2 410

All coefficients of objective function are now equal to zero. then the optimal solution is found: T=30, C=40; Z=410

Page 19: Simplex Method for solving LP problems with two variables.

Using Simplex method, solve the LP problems modeled in chapter1.

3- Applications

Page 20: Simplex Method for solving LP problems with two variables.

The mathematical model of problem is:

Max Z= 3x1 + 5x2

S.t. x1 4 (Plant 1 constraint)

2x2 12 (Plant 2 constraint)3x1+ 2x2 18 (Plant 3 constraint)x1, x2 0

3.1- Solving of problem1

Page 21: Simplex Method for solving LP problems with two variables.

11stst Step: Step: Initial Simplex tableau

We start by a basic solution Z=0.

Non-Basic variables

Bas

ic

vari

able

s

  X1 X2 S1 S2 S3 Quantity (Q)

S1 1 0 1 0 0 4

S2 0 2 0 1 0 12

S3 3 2 0 0 1 18

Z 3 5 0 0 0 0

Page 22: Simplex Method for solving LP problems with two variables.

22ndnd Step: Step: Entering variable

The largest positive coefficient in the objective function is 5 then the entering variable will be X2.

33rd rd Step: Step: Leaving variable

The smallest value of quantities (Q) divided by items of pivot column is 12/2=6 then the leaving variable will be S2 .

Page 23: Simplex Method for solving LP problems with two variables.

44th th Step: Step: Pivoting

Pivot column

Pivot row

Pivot item   X1 X2 S1 S2 S3 (Q)

S1 1 0 1 0 0 4

S2 0 2 0 1 0 12

S3 3 2 0 0 1 18

Z 3 5 0 0 0 0

Page 24: Simplex Method for solving LP problems with two variables.

44th th Step: Step: Pivoting

  X1 X2 S1 S2 S3 (Q)

S1 1 0 1 0 0 4

X2 0 1 0 1/2 0 6

S3 3 0 0 -1 1 6

Z 3 0 0 -5/2 0 30

All coefficients of objective function aren’t negatives or equal to zero, the optimal solution is not found. Then go to step2.

Page 25: Simplex Method for solving LP problems with two variables.

22ndnd Step: Step: Entering variable

The new largest positive coefficient in the objective function is 3 then the entering variable will be X1.

33rd rd Step: Step: Leaving variable

The smallest value of quantities (Q) divided by items of pivot column is 6/3=2 then the leaving variable will be S3 .

Page 26: Simplex Method for solving LP problems with two variables.

44th th Step: Step: Pivoting

Pivot column

Pivot row

Pivot item  X1 X2 S1 S2 S3 (Q)

S1 1 0 1 0 0 4

X2 0 1 0 1/2 0 6

S3 3 0 0 -1 1 6

Z 3 0 0 -5/2 0 30

Page 27: Simplex Method for solving LP problems with two variables.

44th th Step: Step: Pivoting

All coefficients of objective function are now equal to zero. then the optimal solution is found. X1=2, X2=6, Z=36.

  X1 X2 S1 S2 S3 (Q)

S1 0 0 1 1/3 -1/3 2

X2 0 1 0 1/2 0 6

X1 1 0 0 -1/3 1/3 2

Z 0 0 0 7/2 -1 36

Page 28: Simplex Method for solving LP problems with two variables.

The mathematical model of problem is:

Max Z= 10x1 + 15x2

S.t. 2x1 + 4x2 100 ( aluminum constraint) 3x1 + 2x2 80 ( steel constraint)

x1 , x2 0

3.2- Solving of problem2

Page 29: Simplex Method for solving LP problems with two variables.

11stst Step: Step: Initial Simplex tableau

X1 X2 S1 S2 Quantity (Q)

S1 2 4 1 0 100

S2 3 2 0 1 80

Z 10 15 0 0 0

We start by a basic solution Z=0.

Non-Basic variables

Bas

ic

vari

able

s

Page 30: Simplex Method for solving LP problems with two variables.

22ndnd Step: Step: Entering variable

The largest positive coefficient in the objective function is 15 then the entering variable will be X2.

33rd rd Step: Step: Leaving variable

The smallest value of quantities (Q) divided by items of pivot column is 100/4=25 then the leaving variable will be S1 .

Page 31: Simplex Method for solving LP problems with two variables.

44th th Step: Step: Pivoting

Pivot column

Pivot row

Pivot item X1 X2 S1 S2 Q

S1 2 4 1 0 100

S2 3 2 0 1 80

Z 10 15 0 0 0

Page 32: Simplex Method for solving LP problems with two variables.

44th th Step: Step: Pivoting

X1 X2 S1 S2 Q

X2 1/2 1 1/4 0 25

S2 2 0 -1/2 1 30

Z 5/2 0 15/4 0 375

All coefficients of objective function aren’t negatives or equal to zero, the optimal solution is not found. Then go to step2.

Page 33: Simplex Method for solving LP problems with two variables.

22ndnd Step: Step: Entering variable

The new largest positive coefficient in the objective function is 5/2 then the entering variable will be X1.

33rd rd Step: Step: Leaving variable

The smallest value of quantities (Q) divided by items of pivot column is 30/2=15 then the leaving variable will be S2.

Page 34: Simplex Method for solving LP problems with two variables.

44th th Step: Step: Pivoting

Pivot column

Pivot row

Pivot item

X1 X2 S1 S2 Q

X2 1/2 1 1/4 0 25

S2 2 0 -1/2 1 30

Z 5/2 0 15/4 0 375

Page 35: Simplex Method for solving LP problems with two variables.

44th th Step: Step: Pivoting

All coefficients of objective function are now equal to zero, the optimal solution is found: X1=15, X2=17.5, Z= 412.5.

X1 X2 S1 S2 Q

X2 0 1 3/8 -1/4 17.5

X1 1 0 -1/4 1/2 15

Z 0 0 30/8 -5/4 412.5