the simplex algorithm. abstract: in this lecture we discuss the computational aspects of the simplex...

36
The Simplex algorithm

Upload: shana-gallagher

Post on 27-Dec-2015

223 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

The Simplex algorithm

Page 2: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex tableau. Starting from a BFS, we explain how to proceed step by step till we reach the optimal solution. The Mathematics behind the method (algorithm) will be seen only later. We illustrate the Simplex method by examples.

Page 3: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

Example Consider the LPP

Maximize 21 98 xxz Subject to the constraints

0,

7033

8062

5032

21

21

21

21

xx

xx

xx

xx

Page 4: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

Introducing slack variables, the LPP is same as

Maximize

subject to the constraints

0,,,,

7033

8062

5032

32121

321

221

121

sssxx

sxx

sxx

sxx(*)

1 2 1 2 38 9 0 0 0z x x s s s

Page 5: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

We see that if we take x1, x2 as nonbasic variables, a BFS can be got immediately as (0,0, 50,80,70). Remember the first two components refer to x1, x2 and the last three components refer to s1, s2, s3.

This is possible because in the LHS of the constraint equations (*) the coefficients of the basic variables s1, s2, s3 form an Identity matrix (of size 3 x 3).

Page 6: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

This is the first thing to be had to start the simplex method: the coefficients of the starting basic variables in the constraint equations form an identity matrix so that we can read out the starting BFS. Next we put the objective function and the constraint equations in a table (usually referred to as a Simplex tableau). For this we write the objective function also as an equation:

1 2 1 2 38 9 0 0 0 0z x x s s s

Page 7: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

Simplex tableau (Starting tableau)

BasicBasic zz xx11 xx22 ss11 ss22 ss33 SolutionSolution

zz 11 -8-8 -9-9 00 00 00 00

ss11 00 22 33 11 00 00 5050

ss22 00 22 66 00 11 00 8080

ss33 00 33 33 00 00 11 7070

Page 8: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

We note that the z-row is the objective function row. The remaining 3 rows are the basic variable rows. Each row corresponds to a basic variable; the leftmost variable denotes the basic variable corresponding to that row. Except for the legends (the topmost row and the leftmost column), all the other 4 rows are the objective function row and the constraint equations. Notice that in the objective function row,

Page 9: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

the coefficients of the basic variables are zero. This is the second requirement to start the simplex algorithm. Also we note that in each column corresponding to a basic variable, only that basic variable has a non-zero coefficient, namely 1, and all the other basic variables have zero coefficients.

We see at present, the objective function, z, has value zero. We now seek to make one of the nonbasic variables as basic (and so) one

Page 10: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

of the basic variables will become nonbasic (that is will drop down to zero) and the nonbasic variable that will become basic is chosen such that the objective function will “improve”: i.e. in a maximization problem it will increase and in a minimization problem it will decrease. The nonbasic variable that will become basic is referred to as “entering” variable and the basic variable that will become nonbasic is referred to as “leaving” variable.

Page 11: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

Choose that variable as the “entering” variable which has

Criterion for “entering” variable: (Optimality Condition)

the most –ve coefficient in the z-row in case it is a maximization problem

(as the variable which has the most +ve coefficient in the z-row in case it is a minimization problem).

(Break the ties arbitrarily.)

Page 12: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

Criterion for “leaving” variable (Feasibilty Condition)

0: ijij

i aa

bis least.

Let bi be the RHS of the ith row. Let aij be the coefficient of the entering variable xj in the ith row. The following “minimum ratio test” decides the leaving variable:Choose xk as the leaving variable where k is given as that row index i for which the ratio

(Break the ties arbitrarily.)

Page 13: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

The entering variable column is called the pivot column. The leaving variable row is called the pivot row. The coefficient in the intersection of the two is referred to as the pivot element. Now we apply elementary row operations to modify the simplex tableau so that the pivot column has 1 at the pivot element and zero in all other places.

We say one iteration is over and the new basic feasible solution and the new objective function value can be read from the new tableau. We illustrate by an example.

Page 14: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

The elementary Row operations are as follows:

We shall also change the legend of the new pivot row only as the entering variable.

New pivot row = old pivot row pivot element

New z row = old z row – (coefficient of the entering variable in old z row * New pivot row)

Any other new row = corresponding old row – (old coefficient of the entering variable in that row * New pivot row)

Page 15: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

Simplex tableau (Starting tableau)

BasicBasic zz xx11 xx22 ss11 ss22 ss33 SolutionSolution

zz 11 -8-8 -9-9 00 00 00 00

ss11 00 22 33 11 00 00 5050

ss22 00 22 66 00 11 00 8080

ss33 00 33 33 00 00 11 7070

Enters

LeavesPivot element

Page 16: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

Performing the elementary Row operations, we get the new Simplex tableau below

BasicBasic zz xx11 xx22 ss11 ss22 ss33 SolutionSolution

zz 11 -5-5 00 00 3/23/2 00 120120

ss11 00 11 00 11 -1/2-1/2 00 1010

xx22 00 1/31/3 11 00 1/61/6 00 40/340/3

ss33 00 22 00 00 -1/2-1/2 11 3030

Enters

Leaves Pivot element

Page 17: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

Performing the elementary Row operations, we get the new Simplex tableau below

BasicBasic zz xx11 xx22 ss11 ss22 ss33 SolutionSolution

zz 11 00 00 55 -1-1 00 170170

xx11 00 11 00 11 -1/2-1/2 00 1010

xx22 00 00 11 -1/3-1/3 1/31/3 00 1010

ss33 00 00 00 -2-2 1/21/2 11 1010

Enters

Leaves Pivot element

Page 18: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

Performing the elementary Row operations, we get the new Simplex tableau below.

BasicBasic zz xx11 xx22 ss11 ss22 ss33 SolutionSolution

zz 11 00 00 55 00 00 190190

xx11 00 11 00 -1-1 00 00 2020

xx22 00 00 11 11 00 00 10/310/3

ss22 00 00 00 -4-4 11 22 2020

This is optimal as all entries in z row are 0.

Optimum value = 190 at x1=20, x2=10/3

Page 19: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

(0,40/3) (10,10)

(70/3,0)

(20,10/3)Optimal at

Graphical Solution of the problem

(0,0)

Direction of increasing z

Page 20: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

Problem 2(a) Problem set 3.3B Page 89

Maximize

Subject to the constraints

0,,,

1024

822

40422

4321

4321

4321

4321

xxxx

xxxx

xxxx

xxxx

Example Consider the LPP

1 2 3 42 3 5z x x x x

Page 21: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

Introducing slack variables, the LPP becomes

Maximize

Subject to the constraints

0,,,,,,

1024

822

40422

3214321

34321

24321

14321

sssxxxx

sxxxx

sxxxx

sxxxx

1 2 3 4 1 2 32 3 5 0 0 0z x x x x s s s

Page 22: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

Basic z x1 x2 x3 x4 s1 s2 s3 Sol.

z 1 -2 -1 3 -5 0 0 0 0

s1 0 1 2 -2 4 1 0 0 40

s2 0 2 -1 1 2 0 1 0 8

s3 0 4 -2 1 -1 0 0 1 10

2

x4 0 1 -1/2 1/2 1 0 1/2 0 4

z 1 3 -7/2 11/2 0 0 5/2 0 20

s1 0 -3 4 -4 0 1 -2 0 24

s3 0 5 -5/2 3/2 0 0 1/2 1 14

4

x2 0 -3/4 1 -1 0 1/4 -1/2 0 6 z 1 3/8 0 2 0 7/8 3/4 0 41

x4 0 5/8 0 0 1 1/8 1/4 0 7 s3 0 25/8 0 -1 0 5/8 -3/4 1 29

Page 23: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

The last tableau is the optimal tableau as all entries in the objective function row are ≥ 0 and the LPP is a maximization problem.

Optimal Solution is

x1 = 0, x2 = 6, x3 = 0, x4 = 7

And the Optimal z (= Maximum z)

= 41

Page 24: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

Solve the following LPP:

Maximize 321 42 xxxz

Subject to the constraints

0,,

722

84

1053

321

31

321

321

xxx

xx

xxx

xxx

Page 25: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

Introducing slack variables, the LPP becomes

Maximize

Subject to the constraints

1 2 3 1

1 2 3 2

1 3 3

1 2 3 1 2 3

3 5 10

4 8

2 2 7

, , , , , 0

x x x s

x x x s

x x s

x x x s s s

1 2 3 1 2 32 4 0 0 0z x x x s s s

Page 26: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

Basic z x1 x2 x3 s1 s2 s3 Sol.

z 1 -1 -2 -4 0 0 0 0

s1 0 3 1 5 1 0 0 10

s2 0 1 4 1 0 1 0 8

s3 0 2 0 2 0 0 1 7

s2 0 2/5 19/5 0 -1/5 1 0 6 z 1 7/5 -6/5 0 4/5 0 0 8

x3 0 3/5 1/5 1 1/5 0 0 2

s3 0 4/5 -2/5 0 -2/5 0 1 3

x3 0 11/19 0 1 4/19 -1/19 0 32/19 z 1 29/19 0 0 14/19 6/19 0 188/19

x2 0 2/19 1 0 -1/19 5/19 0 30/19 s3 0 16/19 0 0 -8/19 2/19 1 69/19

Page 27: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

The last tableau is the optimal tableau as all entries in the objective function row are ≥ 0 and the LPP is a maximization problem.

Optimal Solution is

x1 = 0, x2 = 30/19, x3 = 32/19

And the Optimal z (= Maximum z)

= 188/19

Page 28: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

Exceptional cases Identified from the Simplex tableau

* Tie for leaving variable - Degeneracy

If in a Simplex iteration, there is a tie for leaving variable, then the resulting BFS will be degenerate, in the sense that one of the basic variables will also be zero. This may result in getting a new BFS without improving z. And in some cases this may lead to “cycling.”

Page 29: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

* Multiple (Alternative) Optimal Solutions

Suppose in the optimal tableau, some nonbasic variable has zero coefficient in the objective function row. Then that variable can become basic and we would get another BFS. Since the coefficient of the entering variable in the objective function row. The objective function does not improve. Hence the new BFS we get is an alternative Optimal Solution. Usually you are supposed to give all Optimal Solutions.

Page 30: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

* No leaving variable – unbounded Solution

Suppose in a Simplex iteration, some variable can enter but no variable can leave. This will happen when all the entries in the entering variable column are either zero or negative, This means the entering variable (which is right now having the zero value) can be increased indefinitely without violating any of the constraints and thus z can be increased indefinitely or the problem has unbounded solution.

Page 31: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

Problem 5 Problem Set 2.5A Page 61

Shale Oil, located on the island of Aruba, has a capacity of 600,000 barrels of crude oil per day. The final products from the refinery include two types of unleaded gasoline: regular and premium. The refining process encompasses three stages: (1) a distillation tower that produces feedstock, (2) a cracker unit that produces gasoline stock by using a portion of the feedstock produced from the distillation tower, and (3) a blender unit that blends the gasoline stock from the cracker unit and the feedstock from the distillation tower. Both

Page 32: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

Both regular and premium gasoline can be blended from either the the feedstock or the gasoline stock at different production costs. The company estimates that the net profit per barrel of regular gasoline is $7.70 and $5.20, depending on whether it is blended from feedstock or from gasoline stock. The corresponding profit values for the premium grade are $10.40 and $12.30.

Design specifications require 5 barrels of crude oil to produce 1 barrel of feedstock. The capacity of the cracker unit is 40,000 barrels of feedstock a day. All remaining feedstock is directly used in the blender unit to produce end-product gasoline. The demand

Page 33: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

The demand limits for regular and premium gasoline are 80,000 and 50,000 barrels per day.

Develop a model for determining the optimum production schedule for the refinery.

Distillation Tower

Cracker Unit

Blender Unit

Page 34: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

Let x1 units from feedstock be used to blend (=make) regular gasoline

Let x2 units from feedstock be used to blend (=make) premium gasolineLet x3 units from gasoline stock be used to blend (=make) regular gasolineLet x4 units from gasoline stock be used to blend (=make) premium gasoline

Page 35: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

Thus we have to maximize the profit

1 2 3 47.70 10.40 5.20 12.30z x x x x Subject to the constraints

1 2 3 4 120,000x x x x

3 4 40,000x x

1 3 80,000x x

2 4 50,000x x

1 2 3 4, , , 0x x x x

Page 36: The Simplex algorithm. Abstract: In this lecture we discuss the computational aspects of the Simplex algorithm. We shall see how a LPP is put into a simplex

Optimum Solution

1

2

3

4

70,000

10,000

0

40,000

x

x

x

x

Maximum z = 1135000