The Simplex Method

Total Page:16

File Type:pdf, Size:1020Kb

The Simplex Method

THE SIMPLEX METHOD

So far we have solved linear Programming problems graphically. All of the problems have involved only 2 variables, and this has allowed us to draw graphs to show the feasible region. From this we have then been able to determine the extreme points of the region to solve the problem. However, y if there are 3 or more variables then this method is of no use. Instead we use a numerical method based on Gaussioan Elimination. This is called the SIMPLEX METHOD.

 The first thing we need to do is introduce SLACK VARIABLES. A

Let us consider the following problem 

Maximise z =  + y B Subject to 3 + 4y  12 3 + 2y  9   0 , y  0 x O C       We know that the optimal solution occurs at one of the vertices of the feasible region shown below: 

Since the  axis is the line where y = 0 and the y axis where  = 0, let us define AB as u = 0 and BC as v = 0.

The vertices are now the points where exactly two of , y, u and v are zero.

I.e. At O  = y = 0 At A  = u = 0 At B u = v = 0 At C v = y = 0 In effect u and v represent the slack between the maximum available for each constraint and the amount being used. We can therefore replace the inequalities by the equations:

3 + 4y + u = 12 3 + 2y + v = 9

With u  0 and v  0

The problem can now be restated as:

Maximise z =  + y

When 3 + 4y + u = 12 3 + 2y + v = 9

With   0 , y  0, u  0 and v  0

The Standard Form of Linear programming Problems

A problem is in standard form if

1. The objective function is to be maximised. 2. All of the constraints must be in the form . This means that each variable (actual and slack)  0

We can easily obtain the constraints in this form using the fact that if

a  b then -a  -b

Example Write the following Linear Programming problem in standard form and introduce slack variables.

Maximise P = 2 + y

Subject to the constraints  + y  10 4 + 2y  15 3 + y  5   0 , y  0

The 3rd constraint (3 + y  5) is not in the correct form but can be changed to

-3 - y  5 The problem now becomes

Maximise P = 2 + y

Subject to the constraints  + y  10 4 + 2y  15 -3 - y  -5   0 , y  0

We can now introduce slack variables to obtain:

Maximise P = 2 + y

When  + y + u = 10 4 + 2y + v = 15 -3 - y + w = -5   0 , y  0, u  0, v  0 and w  0 The Simplex Method The Simplex Method effectively does a tour of the boundary of the feasible region stopping at the vertices to examine the value of the objective function. We will see that there is a recognisable situation when we have reached the optimal solution. This means that we do not necessarily need to examine each vertex as we did for the graphical method. To solve, we first need to introduce the slack variables and then set up the Simplex Tableau.

Setting up the Simplex Tableau Let us use the example

Maximise z =  + y

When 3 + 4y + u = 12 3 + 2y + v = 9

With   0 , y  0, u  0 and v  0

Firstly we need to rewrite the objective equation = 0 by rearranging it.

z -  - y = 0

NOTE We could have rearranged this as  + y – z = 0 but for the Simplex Method to work we need the values of  and y to be negative at the start.

We then write the equations in a tableau as shown below

 y u v z 3 4 1 0 0 12 3 2 0 1 0 9 -1 -1 0 0 1 0

The first two rows represent the constraint equations with the slack variables and the bottom row represents the objective function.

Iterations of the Simplex Algorithm An iteration of the simplex method moves us along a line of the boundary of the feasible region to another vertex. We can either increase  or y, which will move us along the  or y axes respectively and exam questions will often tell you which one to change. However, if you are not told then the variable which is ALWAYS changed first is the LARGEST NEGATIVE ENTRY in the OBJECTIVE COLUMN. The column in which this variable lies is called the PIVOT COLUMN (Exam question might tell you which is to be the pivot column)

In our example  and y both have values of –1 in the objective row so we have a free choice. We will choose 

 y u v z 3 4 1 0 0 12 3 2 0 1 0 9 -1 -1 0 0 1 0

n t m o u v l i o P c

As we increase  it is clear from the graph that we should stop at vertex C which is on the line 3 + 2y = 9.

 y

 A 3 + 2y = 9

B 3 + 4y = 12 

O C x      



We can find the information from the tableau by dividing the right hand column entries (12 and 9) by the  column entries. The SMALLEST POSITIVE VALUE will occur in the row corresponding to the correct line. This is called the PIVOT ROW. The  value in the first row is 3 and 12  3 = 4; the  value in the second row is also 3 and 9  3 = 3. As 3 is smaller than 4 the second row becomes our pivot row.

 y u v z 3 4 1 0 0 12 12 ÷ 3 = 4 3 2 0 1 0 9 9 ÷ 3 = 3 Pivot row -1 -1 0 0 1 0

n t m o u v l i o P c

The value that is in BOTH the pivot column and the pivot row is called the PIVOT ELEMENT. (The boxed 3 in this case) We now need to make the PIVOT ELEMENT HAVE A VALUE OF 1. We use division and have to perform the same operation to all numbers in that row.

In the example we need to change 3 to 1, so obviously we need to divide by 3 and thus need to divide by three throughout this row.

 y u v z 3 4 1 0 0 12 R2 ÷ 3 1 2/3 0 1/3 0 3 -1 -1 0 0 1 0

We now want to make all other elements in the pivot column zero by carrying out ROW OPERATIONS (similar to solving simultaneous equations).

To change the ‘3’ in row 1 to ‘0’ we need to subtract a multiple of row 2 from it. i.e. 3 times row 2.

 y u v z R1 - 3R2 0 2 1 -1 0 3 1 2/3 0 1/3 0 3 -1 -1 0 0 1 0

We now take our value in row 2 and add it to the value in row 3 to obtain a new value of ‘z’.

 y u v z 0 2 1 -1 0 3 1 2/3 0 1/3 0 3 New value R3 + R2 0 -1/3 0 1/3 1 3 of z

From the tableau we can set y and v to ‘0’ and find that  = 3 and z = 3 (i.e. read along from where the value is 1 in the  column) We have therefore arrived at the vertex where  = 3 and y = 0 giving the objective z = 3.

This is ONE ITERATION of the SIMPLEX ALGORITHM.

However, we still have a negative value in the objective row so we must repeat the process again,

We now have the tableau

 y u v z 0 2 1 -1 0 3 1 2/3 0 1/3 0 3 0 -1/3 0 1/3 1 3 As the column y now has the greatest negative value (the only negative value) in the objective row, this becomes our pivot column and, by division, row R1 will be the pivot row (1.5 is smaller than 4.5).

 y u v z 0 2 1 -1 0 3 3 ÷ 2 = 1.5 Pivot row 1 2/3 0 1/3 0 3 3 ÷ 2/3 = 4.5 -1 -1 0 1/3 1 3

n t m o u v l i o P c

From this the pivot element is 2 so we need to divide row 1 by 2 giving

 y u v z R1 ÷ 2 0 1 1/2 -1/2 0 3/2 1 2/3 0 1/3 0 3 0 -1/3 0 1/3 1 3

We now want to make the y value zero in the other rows. 2 1 So we need to do the following R2 – R1 and R3 + R1 giving 3 3

 y u v z 0 1 1/2 -1/2 0 3/2 R2 - 2/3R1 1 0 -1/3 2/3 0 2 R3 + 1/3R1 0 0 1/6 1/6 1 3.5

3 1 Setting u and v to zero gives us  = 2, y = and z = 3 (3.5). 2 2 This corresponds to point B on the graph.

From our knowledge of solving using a graphical method we know that B will be the optimal solution. We can tell when we have reached the optimal solution, as the objective row will contain no negative values.

OPTIMAL CONDITION If the objective row of the tableau contains no negative entries then the solution is optimal. Example 2 Use a simplex tableau to solve the Linear Programming problem. Begin by pivoting on an element chosen from the  column. Write down the values of , y and f at the end of each iteration.

Maximise f = 9 + 4y

Subject to 3 + 4y  48 2 + y  17 3 + y  24   0, y  0

Solution Introduce the slack variables

3 + 4y + u = 48 2 + y + v = 17 3 + y + w = 24 -9 - 4y + f = 0

The Simplex Tableau is

x y u v w f 3 4 1 0 0 0 48 2 1 0 1 0 0 17 3 1 0 0 1 0 24 -9 -4 0 0 0 1 0

 is the pivot column (told but also the largest negative entry in the objective column)

48  3 = 16 17  2 = 8.5 24  3 = 8

8 is the lowest so R3 is the pivot row. This means that 3 is the pivot element.

R3  3

x y u v w f R1 3 4 1 0 0 0 48 R2 2 1 0 1 0 0 17 R3 1 1/3 0 0 1/3 0 8 R4 -9 -4 0 0 0 1 0

Pivot about the  values i.e. make all the  values in R1, R2 and R4 all equal 0.

R1 – 3R3 R2 – 2R3 R4 + 9R3 x y u v w f R1 0 3 1 0 -1 0 24 R2 0 1/3 0 1 -2/3 0 1 R3 1 1/3 0 0 1/3 0 8 R4 0 -1 0 0 3 1 72

At this point set y and w to 0 giving

 = 8 , y = 0 and f = 72

As we still have a negative value in our object row, we have to repeat the process and do a second iteration, this time with y as the pivot column as it is the largest (and only) negative entry.

1 1 24  3 = 8 1  = 3 8  = 24 3 3

3 is the lowest so R2 is the pivot row. 1 This means that is the pivot element. 3

1 R2  3

x y u v w f R1 0 3 1 0 -1 0 24 R2 0 1 0 3 -2 0 3 R3 1 1/3 0 0 1/3 0 8 R4 0 -1 0 0 3 1 72

1 R1 – 3R2 R3 - R2 R4 + R2 3

x y u v w f R1 0 0 1 -9 5 0 15 R2 0 1 0 3 -2 0 3 R3 1 0 0 -1 1 0 7 R4 0 0 0 3 1 1 75

As all the entries in the objective row are non-negative this is the optimal solution

If we set v and w to 0 we get

 = 7 , y = 3 and f = 75 Example 3

Maximise the objective function f = - + 8y + z

Where  + 2y + 9z  10 y + 4z  10   0 , y  0 , z  0 Solution to example 3

Objective function f = - + 8y + z f +  - 8y – z = 0

Slack variables

 + 2y + 9z + u = 10 y + 4z + v = 12

Simplex tableau

x y z u v f 1 2 9 1 0 0 10 0 1 4 0 1 0 12 1 -8 -1 0 0 1 0

-8 is largest negative value so pivot about y

10  2 = 5 12  1 = 12

5 is the lowest entry so R1 is the pivot row. This means that 2 is the pivot element.

R1  2

x y z u v f R1 1/2 1 9/2 1/2 0 0 5 R2 0 1 4 0 1 0 12 R3 1 -8 -1 0 0 1 0

R2 – R1 R3 + 8R1

x y z u v f R1 1/2 1 9/2 1/2 0 0 5 R2 -1/2 0 -1/2 -1/2 1 0 7 R3 5 0 35 4 0 1 40

Setting , z, and u to 0 gives y = 5 and f = 40

As all values in the objective row are non-negative, this is the optimal solution.

The maximum value of ‘f’ = 40 occurs when  = 0, y = 5 and z = 0.

Recommended publications