Simplex
Method
Eng. Shimaa Abouelenein
Simplex Method
• A linear programming algorithm that can solve problems having more than 2
decision variables.
• This technique involves generating a series of solutions in tabular form,
called tables. This process continues as long as a positive rate or profit (cost)
exists.
• Slack variable: variable added to a <= constrain to convert it to an equation
(=).
2
Simplex Method
• Example (All constrains are <=)
Solve the following problem using the simplex method,
Maximize :
Z = 3X1 + 5X2
Subject to:
X1 <= 4
2X2 <= 12
3X1 + 2X2 <= 18
X1, X2 >= 0
3
Simplex Method (Standard Form)
• Solution:
1. Initialization (Standard Form)
Maximize Z:
Subject to:
Z - 3X1 + 5X2 =0
X1 +S1 =4
2X2 + S2 = 12
3X1 + 2X2 + S3 = 18
X1, X2, S1, S2, S3 = 0
4
Simplex Method (Initial Table)
• Solution:
2. Initialization (Initial Table) Entering
variable
Basic X1 X2 S1 S2 S3 Solution
Variables
Z -3 -5 0 0 0 0
S1 1 0 1 0 0 4
S2 0 2 0 1 0 12
S3 3 2 0 0 1 18
Leaving
variable
Pivot column
Pivot value Pivot row
5
Simplex Method (Initial Table)
Note that:
• Pivot column: smallest negative value in Z-row.
• Pivot row: divide the solution column values by the corresponding pivot
column values then determine the row which has the smallest value greater
than zero.
• By investigating the first row (Z-row) of the initial table, we find that there are
some negative values. Therefore, the current solution is not optimal.
6
Simplex Method (Iteration)
• Solution:
3. Iteration
▪ Determine the entering variable by selecting the most negative value in the Z-row,
therefore, the most negative is -5. Consequently, X2 is the entering variable.
▪ Determine the leaving variable by using the minimum ratio test as following:
Basic variable Entering variable Solution Ratio
X2
(1) (2) (2)/(1)
S1 0 4 None
S2 2 12 6
(leaving var) (Smallest ratio)
S3 2 18 9
7
Simplex Method (Iteration)
• Solution:
3. Iteration
▪ Solving for new solutions by using the eliminatory row operation as following:
1. New pivot row = Old pivot row / Pivot value
Basic X1 X2 S1 S2 S3 Solution
Variables
Z
S1
X2 0 1 0 1/2 0 6
S3
Note that X2 becomes in the basic variables list instead of S2
8
Simplex Method (Iteration)
• Solution:
3. Iteration
▪ For the other row apply this rule:
2. New row = Old row - (the coefficient of the row in the pivot column * (new pivot
row)).
For S1:
1 0 1 0 0 4
- (0) 0 1 0 ½ 0 6
________________________
1 0 1 0 0 4
9
Simplex Method (Iteration)
• Solution:
3. Iteration
▪ For the other row apply this rule:
2. New row = Old row - (the coefficient of the row in the pivot column * (new pivot
row)).
For S3:
3 2 0 0 1 18
- (2) 0 1 0 ½ 0 6
________________________
3 0 0 -1 1 6
10
Simplex Method (Iteration)
• Solution:
3. Iteration
▪ For the other row apply this rule:
2. New row = Old row - (the coefficient of the row in the pivot column * (new pivot
row)).
For Z:
-3 -5 0 0 0 0
- (-5) 0 1 0 ½ 0 6
________________________
-3 0 0 5/2 0 30
11
Simplex Method (Iteration)
• Solution:
The solution is not optimal, since there is a negative values in the first row.
Basic X1 X2 S1 S2 S3 Solution
Variables
Z -3 0 0 5/2 0 30
S1 1 0 1 0 0 4
X2 0 1 0 1/2 0 6
S3 3 0 0 -1 1 6
The most negative The smallest ratio is 6/3 = 2;
value; therefore, X1 is therefore, S3 is the leaving
the entering variable variable 12
Simplex Method (Iteration)
• Solution:
Apply the same rules, we will obtain this solution:
Basic X1 X2 S1 S2 S3 Solution
Variables
Z 0 0 0 3/2 1 36
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
This solution is optimal; since there is no negative value in the first row.
Basic variables are X1 = 2, X2 = 6 and S1 = 2
Non-basic variables are S2 = S3 = 0
Z=36
13