The Simplex Method

Step 1) Put the problem in canonical or row 0 form.
Step 2) Construct the simplex tableau.
Step 3) Obtain an initial BFS.
Step 4) Determine whether the current BFS is optimal.
Step 5) If the current BFS is not optimal, then
Step 5a) Choose a nonbasic variable to enter the basis.
Step 5b) Use the ratio test to determine which basic variable must leave the basis.
Step 6) Perform the pivot operation on the appropriate element of the tableau.
Step 7) Go to Step 4.

Example 1)
 
Maximize 4.5 x1 + 4 x2
st
30 x1 + 12 x2 <= 6000 
10 x1 + 8 x2 <= 2600
4 x1 + 8 x2 <= 2000
x1, x2 >= 0

Standard Form:
Maximize z
st
z - 4.5 x1 - 4 x2 = 0
30 x1 + 12 x2 + x3 = 6000
10 x1 + 8 x2 + x4 = 2600
4 x1 + 8 x2 + x5 = 2000
x1, x2, x3, x4, x5 >= 0

The corresponding tableau is shown below.

The problem is in canonical form, so it is easy to read off an initial basic feasible solution.

In this case the basic variables are z, x3, x4 and x5 and x1 and x2 are non-basic.

The current solution is x3 = 6000, x4 = 2600, x5 = 2000 and z (the objective function value) = 0.
 
z x1 x2 x3 x4 x5 b basis
1 -4.5 -4 0 0 0 0 z
0 30 12 1 0 0 6000 x3
0 10 8 0 1 0 2600 x4
0 4 8 0 0 1 2000 x5

Since the coefficients of x1 and x2 in row 0 of the tableau are negative, they are eligible to enter the basis.

In other words, by increasing either x1 or x2, we will have to increase z to satisfy the constraint z - 4.5 x1 - 4 x2 = 0.

We will select x1 to enter the basis (become non-zero) and now have
to determine which variable will leave the basis (become zero).

Consider the constraint represented by row 1 of the tableau:

30 x1 + 12 x2 + x3 = 6000 => x3 = 6000 - 30 x1 - 12 x2.

Since x2 = 0 (it will stay non-basic) and x3 >= 0, this means that

x1 <= 200 = 6000/30.

10 x1 + 8 x2 + x4 = 6000 => x4 = 2600 - 10 x1 - 8 x2

Since x2 = 0 and x4 >= 0, x1 <= 260 = 2600/10.

4 x1 + 8 x2 + x5= 2000 => x5 = 2000 - 4 x1 - 8 x2

Since x2 = 0 and x5 >= 0, x1 <= 500 = 2000/4.

Thus, we can increase x1 to 200, but will have to decrease x3 to 0.

If we try to increase x1 to more than 200, we would have to make x3 < 0
which would give us an infeasible solution x1 enters the basis and x3 leaves.

We now solve the system of constraints for z, x1, x4, and x5 in terms of x2 and x3.

We do this by pivoting on row 1 (since x3 is leaving), column 1 (since x1 is entering).

Divide row 1 by 30.
 
z x1 x2 x3 x4 x5 b basis
1 -4.5 -4 0 0 0 0 z
0 1 0.4 0.03333 0 0 200 x3
0 10 8 0 1 0 2600 x4
0 4 8 0 0 1 2000 x5

 

Add 4.5 times row 1 to row 0.

Add -10 times row 1 to row 2.

Add 4 times row 1 to row 3.
 
z x1 x2 x3 x4 x5 b basis
1 0 -2.2 0.15 0 0 900 z
0 1 0.4 0.03333 0 0 200 x1
0 0 4 -0.3333 1 0 600 x4
0 0 6.4 -0.1333 0 1 1200 x5

The basic feasible solution is x1 = 200, x2 = 0, x3 = 0, x4 = 600, x5 = 1200 which has an objective function value of 900. Notice that if we can increase x2, we could force an increase in z. Thus, we want x2 to enter the basis.

Rather than writing out all the equations to determine which variable must leave the basis as we did last time,

we can before the ratio test to determine which variable should leave the basis. That is, we look at each row i

where the incoming variable xj has a positive coefficient and look at the ratio of the right-hand side of row i (i.e. b column of the tableau) to the coefficient of the entering variable in row i (i.e. aij). Which ever row i gives the minimum value of bi/aij is the row containing the basic variable that will leave the basis.

x1: 200/0.4 = 500
x4: 600/4 = 150
x5: 1200/6.4 = 187.5

Thus, we can increase x2 from 0 to 150 and x4 will leave the basis.

Pivot on row 2 (since x4 is leaving), column 2 (since x2 is entering).

Divide row 2 by 4.
 
z x1 x2 x3 x4 x5 b basis
1 0 -2.2 0.15 0 0 900 z
0 1 0.4 0.03333 0 0 200 x1
0 0 1 -0.0833 0.25 0 150 x4
0 0 6.4 -0.1333 0 1 1200 x5

Add 2.2 times row 2 to row 0.

Add -4 times row 2 to row 1.

Add -6.4 times row 2 to row 3.
 
z x1 x2 x3 x4 x5 b basis
1 0 0 -0.0333 0.55 0 1230 z
0 1 0 0.06667 -0.1 0 140 x1
0 0 1 -0.0833 0.25 0 150 x2
0 0 0 0.4 -1.6 1 240 x5

The new basic feasible solution is x1 = 140, x2 = 150, x3 = 0, x4 = 0, x5 = 240 which has objective function value 1230. Since the coefficient of x3 in row 0 is negative, we let x3 enter the basis.

Observe that row 2 corresponds to the equation x2 - 0.0833 x3 + 0.25 x4 = 150. Since x4 = 0, we can rewrite this as x2 = 150 + 0.0833 x3. This means that we can always increase x2 to accommodate any increase in x3. Therefore, we can keep x2 in the basis and only need to apply the ratio test to rows 1 and 5.

x1: 140/0.06667 = 2100
x5: 240/0.4 = 600.

x5 will leave the basis.

Here is the resulting tableau:
 
z x1 x2 x3 x4 x5 b basis
1 0 0 0 0.41667 0.08333 1250 z
0 1 0 0 0.16667 -0.1667 100 x1
0 0 1 0 -0.0833 0.20833 200 x2
0 0 0 1 -4 2.5 600 x3

Since there are no negative coefficients in row 0 we can not improve the objective function any more.

The Simplex method terminates with the solution x1 = 100, x2 = 200, x3 = 600, x4 = 0, x5 = 0 which has an objective function value of 1250.

Example 2)
Although we have outlined the fundamental steps of the simplex algorithm, we still have to "tweak"
the procedure to handle to detect when an LP is unbounded or infeasible.

Maximize X + 2Y
s.t.
X - 2Y <= 2
-2X + Y <= 2
X, Y >= 0
 

Step 1)

Maximize Z
s.t.
Z - X - 2Y = 0
X - 2Y + S1 = 2
-2X + Y + S2 = 2
X, Y, S1, S2 >= 0
 
 

Step 2) Here is the initial tableau.
 
Z X Y S1 S2 b basis
1 -1 -2 0 0 0 Z
0 1 -2 1 0 2 S1
0 -2 1 0 1 2 S2

 

Step 3) The initial BFS is Z = 0, S1 = 2, S2 = 2 with X and Y nonbasic.

Step 4) Since X and Y have negative coefficients in the top row (row 0) of the tableau, the solution is not optimal.

Step 5) Select Y to enter the basis and S2 to leave the basis.

Step 6) Pivot on row 2 (the third row), column 5.
 
Z X Y S1 S2 b basis
1 -5 0 0 2 4 Z
0 -3 0 1 2 4 S1
0 -2 1 0 1 2 Y

 

The tableau represents the following system:

Z - 5X + 2 S2 = 4
-3X + S1 + S2 = 4
-2X + Y + S2 = 2

Since S2 is nonbasic, the system reduces to
Z = 4 + 5X
S1 = 4 + 3X
Y = 2 + 2X

Notice that for any a>= 4, the following solution has objective function value a .

X = (a - 4) / 5,
Y = 2 + (2)(a - 4)/5,
S1 = 4 + (3)(a - 4)/5.

Thus, the problem is unbounded.

If a variable with a negative coefficient in row 0 has a nonpositive coefficient in each constraint row, then the problem is unbounded.