Chapter II Simplex(1)
Chapter II Simplex(1)
SIMPLEX METHOD
INTRODUCTION
The graphical method to solving LPPs provides fundamental concepts for fully
understanding the LP process. However, the graphical method can handle problems
involving only two decision variables (say X1 and X2).
The simplex method is an ITERATIVE or “step by step” method or repetitive algebraic approach that
moves automatically from one basic feasible solution to another basic feasible solution improving the
situation each time until the optimal solution is reached at.
Note:
The simplex method starts with a corner that is in the solution space or feasible
region and moves to another corner I the solution space improving the value of the
objective function each time until optimal solution is reached at the optimal corner.
Matrices
Different types of matrices:
1. Row matrix
A matrix which has exactly one row
Example:
(1 2 3 4 ) ==>1x 4 matrixes
2. Column matrix
A matrix which has exactly one column
Example:
5
==> 3x1 Matrix
6
3. Square matrix
1
A matrix in which the No of rows (m) = the No of columns (n)
Example:
1 2
==> 2x2 square Matrix
3 4
0 0
==> 3x2 Zero Matrix
0 0
0 0
5. Diagonal Matrix
The elements aij (i=j) are called diagonal elements of a square matrix.
Example:
1 2 3
The diagonal elements are: a11=1, a22=5 and a33=9
4 5 6
7 8 9
A square matrix of every element other than diagonal elements is zero, is called a
diagonal matrix.
Example:
1 0 0 0 0 0 0
0 5 0 ; 0 5 and 0 0
0 0 9
6. Identity Matrix
A diagonal matrix whose diagonal elements are all equal to 1(unity)
Example:
1 0
Is an identity matrix
Scope
0 of
1 solution of LPP by simplex method
2
Maximize Z with inequalities of constraints in “< “form.
Example:
Solve the problem using the simplex approach
Max.Z=300x1 +250x2
Subject to:
2x1 + x2 < 40 (Labor )
x1+3x2 < 45 (Machine)
x1 < 12 (Marketing)
x1, x2 > 0
Solution
Step 1
Formulate LPP Model
Step 2
Standardize the problem
i.e Convert constraint inequality into equality form by introducing a variable called
Slack variable.
Slack Variables:
A slack variable(s) is added to the left hand side of a < constraint to covert the
constraint inequality in to equality. The value of the slack variable shows unused
resource.
A slake variable emerges when the LPP is a maximization problem.
Slack variables represent unused resource or idle capacity. Thus, they don’t
produce any product and their contribution to profit is zero.
Slack variables are added to the objective function with zero coefficients.
Let that s1, s2, and s3 are unused labor, machine and marketing hrs respectively.
3
Max.Z=300x1 +250x2 + 0 s1 +0 s2+ 0 s3
St:
2 x1+x2 + s1 +0 s2+ 0 s3= 40 Standard form
x1+3x2 +0s1 + s2+ 0 s3= 45
x1 + 0s1 + 0s2+ s3= 12
x 1 , x2 , s1 , s2, s3 > 0
Step 3
Obtain the initial simplex tableau
To represent the data, the simplex method uses a table called the simplex table or
the simplex matrix.
==> In constructing the initial simplex tableau, the search for of the optimal
solution begins at the origin. Indicating that nothing can be produced;
Thus, first assumption, No production implies that x1 =0 and x2=0
==>2 x1+x2 + s1 +0 s2+ 0 s3= 40 ==> x1+3x2 +0 s1 + s2+ 0 s3= 45
2(0) +0 + s1 +0 s2+ 0 s3= 40 0 +3(0) + 0s1 + s2+ 0 s3= 45
s1= 40 – Unused labor hrs. s2= 45 – Unused machine
hrs.
Note:
In general, whenever there are n variables and m constraints (excluding the non-
negativity), where m is less than n (m<n), n-m variables must be set equal to
zero before the solution can be solved algebraically.
a. Basic variables are variables with non-zero solution values.
Or: basic variables are variables that are in the basic solution. Basic variables
have 0 values in the Cj-Zj row.
b. Non-basic variables are variables with zero solution values.
Or: non-basic variables are variables that are out of the solution.
==>n=5 variables (x1 , x2, s1, s2, and s3) and m=3 constraints (Labor, machine
and marketing constraints), excluding non-negativity.
[
4
Therefore, n-m=5-3=2 variables(x1 and x2) are set equal to zero in the 1 st simplex
tableau. These are non-basic variables. 3 Variables (s1, s2, and s3) are basic
variables (in the 1st simplex tableau) because they have non-zero solution values.
Step 4
Construct the initial simplex tableau
Initial simplex tableau
Slack variables
Real
Basic
or
columns
Pro or
decis
fit Solutio
ion
per n
varia
quantity
Solution
uni variabl
column
bles
t e
colu
col column
mn
um
300 250 0 0
Cj Profit per unit
0
X1 X2 S1 S2
SV Q
S3
2 1 1 0 40 R1
0 S1
0 Constraint
1 3 0 1 45 R2
equation
0 S2
0
R3
1 0 0 0 Gross Profit
0 S3 12
1 Net Profit
0 0 0 0 row
Zj 0 /Indicator
0
Cj - 300 250 0 0
Zj 0
Step 5:
Choose the “incoming” or “entering” variables
Note:
The entering variable is the variable that has the most positive value in the Cj -
Zj row also called as indicator row. Or the entering variable is the variable that
has the highest contribution to profit per unit.
a. X1 in our case is the entering variable
b. The column associated with the entering variable is called key or pivot column
( X1 column in our case )
5
Step 6
Choose the “leaving “or “outgoing” variable
==> In this step, we determine the variable that will leave the solution for X1 (or
entering variable)
Note:
The row with the minimum or lowest positive (non-negative) replacement
ratio shows the variable to leave the solution.
Note: RR>0
The variable leaving the solution is called leaving variable or outgoing
variable.
The row associated with the leaving variable is called key or pivot row (s 3
column in our case)
The element that lies at the intersection of the pivot column and pivot row is
called pivot element(No 1 in our case)
Step 7
Repeat step 3-5 till optimum basic feasible solution is obtained.
Or: repeat step 3-5 till no positive value occurs in the Cj - Zj row.
Note:
Divide each element of the pivot row by the pivot element to find new values in
the key or pivot row.
Perform row operations to make all other entries for the pivot column equal
to zero.
2nd simplex tableau
300 250 0 0
Cj
0
X1 X2 S1 S2
SV Q
S3
0 1 1 0 16 R’1=R1-2R3
0 S1
-2
0 3 0 1 33 R’2=R2-R3
0 S2
-1
30 X1 1 0 0 0 12 R’3=R3
1
6
0 1
300 0 0 0
Zj 3600
300
Cj - 0 250 0 0
Zj -300
300 250 0 0
Cj
0
X1 X2 S1 S2
SV Q
S3 R’’1=R’1-R’2
0 0 1 -1/3 R’’2=R2/3
0 S1 5
-5/3
R’’3=R’3
25 0 1 0 1/3
X2 11
0 -1/3
30 1 0 0 0
X1 12
0 1 Since all the Cj - Zj
300 250 0 250/3
Zj 6350 < 0 optimal solution
650/3
is reached at.
Cj - 0 0 0 -250/3 Therefore, X1=12,
Zj - 650/3
X2=11, S1=5 and
Max Z=6350
Exercise:
A Juice Company has available two kinds of food Juices: Orange Juice and Grape
Juice. The company produces two types of punches: Punch A and Punch B. One
bottle of punch A requires 20 liters of Orange Juice and 5 liters of Grape Juice.1
Bottle of punch B requires 10 liters of Orange Juice and 15 liters of Grape Juice.
From each of bottle of Punch A a profit of $4 is made and from each bottle of Punch
B a profit of $3 is made .Suppose that the company has 230 liters of Orange Juice
and 120 liters of Grape Juice available
Required:
a. Formulate this problem as a LPP
b. How many bottles of Punch A and Punch B the company should produce in order
to maximize profit? (Using the simplex method)
c. What is this maximum profit?
7
Solution:
Juice needed for one bottle of
Juice Punch A Punch B Juice Available
_____________________________________________________________________
Orange Juice (lt) 20 10 230
Grape Juice (lt) 5 15 120
Profit per tent $4 $3
___________________________________________________________________________________
LPP Model
Max Z=4X1 +3X2
St:
20X1 +10X2 < 230 Orange Constraint
5X1 +15X2 < 120 Grape Constraint
X1, X2 > 0 Non-negativity constraint
Standard form
Max.Z=4x1 +3x2 + 0 s1 +0 s2+ 0 s3
St:
20 x1+3x2 + s1 +0 s2 = 230
Standard form
5x1+15x2 +0s1 + s2+ = 120
x1 , x2 , s1 , s2, >0
Where, s1 =Unused orange juice
s2 =Unused grape juice
4 3 0
Cj
0
X1 X2 S1
SV Q
S2
420 3
10 0
1
C
0j S1 230
0
0
5X1 X15
2 S10
0 SV
S2 Q
120
S
12
10 1/2
0 1/20
0 11.
4 X
Z1j 0
0
0 5 2nd simplex tableau
Cj - 40 25/2
3 -1/4
0 62.
0 S2
Zj 0
1 5
4 2 1/5
Zj 8 46
0
Cj - 0 1 -1/5
Zj 0
Optimal simplex tableau
4 3 0
Cj
0
X1 X2 S1
SV Q
S2
1 0 3/50
4 X1 9
-1/25
0 1 -1/50
0 X2 5
2/25
X1= 4 3 0.12 9 bottles of punch A
Zj 51
X2= 0.08 5 bottles of punch B
s1 Cj - 0 0 - 0.12 =0
s2 Zj -0.08 =0
MaxZ=$51
Exercise:
Solve the following LPPs using the simplex method
1. Max.Z=3x1 +5x2 2. Max.Z=20x1 +10x2
Subject to: Subject to:
x2 < 6 5x1+4x2 < 250
3x1+2x2 < 18 2x1+5x2 < 150
x1, x2 >0 x1, x2 >0
Answer: Answer:
x1=2, x2 =6, s1 =0 , s2=0 and MaxZ=$36 x1=50, x2 =0, s1 =0 , s2=50 and
MaxZ=$1,000
9
2. Conversion method
Minimization by maximizing the dual
Surplus Variable (-s):
A variable inserted in a greater than or equal to constraint to create
equality. It represents the amount of resource usage above the minimum
required usage.
Surplus variable is subtracted from a > constraint in the process of
converting the constraint to standard form.
Neither the slack nor the surplus is negative value. They must be
positive or zero.
Example:
1. 2x1+x2 < 40 ==>is a constraint inequality
x1= 12 and x2= 11==> 2x1+x2+s = 40 ==>2(12)+11+s = 40
==> s=5 unused resource
2. 5x1+3x2 < 45
x1= 12 and x2= 11==> 5x1+3x2+s = 45 ==>5(12)+3(11)+s = 45
Note:
Type of constraint To put into standard form
< --------------------------------------------- Add a slack variable
= ---------------------------------------------Add an artificial variable
> ---------------------- Subtract a surplus variable and add artificial variable
1. Big M-method
10
/Charnes Penalty Method/
The Big-M Method is a method which is used in removing artificial variables from the
basis .In this method; we assign coefficients to artificial variables, undesirable from
the objective function point of view. If objective function Z is to be minimized, then
a very large positive price (called penalty) is assigned to each artificial variable.
Similarly, if Z is to be maximized, then a very large negative price (also called
penalty) is assigned to each of these variables.
11
Step 2
Initial simplex tableau
The initial basic feasible solution is obtained by setting x 1= x2= s1= s2=0
No production, x1= x2= s1=0==>20(0) +15(0) - 0+A1 = 100 ==> A1 = 100
x1= x2= s2=0==>0(0)+3(0) - 0+A2 =15==> A2 = 15
Cj 25 30 0 0
M M
X1 X2 S1 S2 RR
SV Q
A1 A2
100/20=5
20 15 -1 0 1
M A1 100
0
15/2=7.5
2 3 0 -1 0
M A2 15
1
22M 18M -M -M M 115
Zj
M M
25 -22M 30- 18M M M Note:
Cj - Zj
0 0 Once an
artificial variable has left the basis, it has served its purpose and can therefore be
removed from the simplex tableau. An artificial variable is never considered for re-
entry into the basis.
2nd Simplex Tableau
Cj 25 30 0 0
M
X1 X2 S1 S2
SV Q
A2
R’1=R1/20
1 3/4 -1/20 0
25 X1 5
0
R’2=R2-2 R’
0 3/2 1/10 -1
M A2 5
1
25 30 0
Cj
Zj 025 75/4+3/2M -5/4+1/10M -M 125+5
M M
X1 X2 S1 3rd Simplex
SV 0 45/4-3/2M 5/4-1/10 M M Q
Cj - Zj S2 Tableau
0
1 0 -1/10
25 X1 5/2
1/2
0 1 1/15
30 X2 10/3
-2/3
25 30 -1/2 12
Zj 162.5
-15/2
0 0 1/2
Cj - Zj
15/2
Cj - Zj > 0==>Optimal solution is reached
X1=5/2
X2=10/3 and MinZ=162.5
Note:
As long as an “A” variable is available in the solution variable column, the solution
is infeasible.
2. Use the penalty (Big-M) method to solve the following LPP
Min Z=5x1 +3x2
Subject to:
2x1+4x2 < 12
2x1+ 2x2 = 10
5x1+ 2x2 > 10
x1, x2 >0
Solution
Min Z=5x1 +3x2 +0s1+0s2 +MA1+MA2
Subject to: If no production
2x1+4x2+s1 = 12 ==>x1 =x2=0==>s1=0 (Solution Value in the initial simplex
tableau) 2x1+2x2 +A1 =10 ==>x1 =x2=0==>A1 =15 (Solution Value in the initial
simplex tableau)
5x1+2x2 –s2 +A1=10 ==>x1=x2=s2=0==>A2=10(Solution Value in the initial simplex
tableau) x1, x2 , s1, s2 ,A1 ,A2 > 0
Initial Simplex tableau
5 3 0 0
Cj
M M
RR
X1 X2 S1 S2 A1
SV Q
A2 6
2 4 1 0 0
0 S1 12 5
0
2 2 0 0 1 2
M A1 10
0
5 2 0 -1 0
M A2 10
1
7M 4M 0 M M
Zj 20 M
M 13
Cj - 5 -7M 3- 4M 0 -M 0
Zj 0
2nd simplex tableau
5 3 0 0
Cj
M
X1 X2 S1 S2
SV Q
A1
0 16/5 1 2/5
0 S1 8
0
0 6/5 0 2/5
M A1 6
1
1 2/5 0 -1/5
5 X1 2
0 3rd
5M 6/5M +2 0 2/5M -1 10+6 simplex
Cj Zj 5 3 0 0 tableau
M M
Cj - 0M -6/5M +1 0 -
Zj X1
2/5M+1 X02 S1 S2
SV Q
A1
0 1 5/16 1/8
3 X2 2.5
0
0 0 -3/8 1/4
M A1 3
1
0 0 -1/8 -1/4
5 X1 5 3 0 1
0 Cj
5 3 0 -3/8M +5/6 M/4- 12.5+3
Zj
7/8 M X1 X2 S1 M
SV Q
0 0 S2 3/8M -5/6 4th
Cj - Z j
-M/4+7/8 0
0 1 1/2 Simplex
3 X2 1
0 tableau
0 0 -3/2
0 S2 12
1
0 0 -1/2
5 X1 4
0
5 143 -1
Zj 23
0
0 0 1
Cj - Z j
0
X1=4, X 2=1, S1=0, S2=12 and MinZ=23
3. Use the penalty (Big-M) method to solve the following LPP
Max Z=2x1 +x2+3x3
Subject to:
2x1+ x2 + x3 < 5
2x1+ 3x2 +4x3 = 12
x1, x2 , x3 >0
Solution
Cj 2 1 3 0
-M
RR
X1 X2 X3 S1
SV Q
A1
2.5
1 1 2 1
0 S1 5
0
3
2 3 4 0
-M A1 12
1
-2M -3M -4M 0
Zj -12 M 2
-M nd
X1 X2 X3 S1
SV Q
A1
1/2 1/2 1 1 RR
3 X3 5
0 5
2 3 4 0
-M A1 12 2
1
3/2 -M +3/2 3
Zj 152M+3/2 -2M+15/2
-M
Cj - 1/22 M-1/2 0 -2M-3/2
Zj 0
3rd simplex tableau
Cj 2 1 3 0
RR
SV X1 X2 X3 S1 Q
6
3 X3 1/2 0 1 3/2 1.5
1 X2 0 1 0 -2 2 Not
defined
Zj 3/2 1 3 5/2 13/2
Cj - 1/2 0 0 -
Zj 5/2
4th
simplex tableau
2 1 3
Cj
0
X1 X2 X3
SV Q
S1
1 0 2
3 X1 3
3
0 1 0
1 X2 2
-2
2 1 4
Zj 8
4 C j - Zj <
Cj - 0 0 -1 0==>optimal
Zj -4 solution
16
1. Min Z=10x1 +5x2
Subject to:
2x1 + 5x2 > 150
3x1+ x2 > 120
x1, x2 >0
Ans: x1=450/13, x2 =210/13 and Min Z=$540
Note:
To get an initial feasible solution
17
Standard form
Max.Z=6x1 +8x2 + 0 s1 +0 s2+ 0 s3-M A2- M A3
St:
x2 + s1 =4
x1+ x2 + A2 =9
6x1+2x2 - s3 + A3 =24 Standard form
Note:
18
For the initial basis, use artificial variables for constraints that have them.
Otherwise, use a constraint slack variable. Hence, surplus variables will not
appear in an initial solution.
Example:
If the equation is max Z:
Cj
X1 X2 S1
SV Q
S3
Zj
5 2 5
Cj - Z j
0
19
In such a case,X1 is the entering variable
3. Infeasibility
A situation with no feasible solution may exist if the problem was formulated
improperly.
Infeasibility comes about when there is no solution that satisfies all of the
problem’s constraints.
4. Unbounded Solutions
No finite solution may exist in problems that are not bounded .This means that a
variable can be infinitely large without violating a constraint.
20
The procedure in unbounded solution is to divide each quantity column number by
the corresponding pivot column number. The row with the smallest positive ratio is
replaced. But if the entire ratios turn out to be negative or undefined, it indicates
that the problem is unbounded.
Example:
Maximization case
6 9 0
Cj
0
X1 X2 S1 RR
SV Q
S2
30/-1=-30
-1 1 2 Unacceptable
9 X2 30 RRs
0
-2 0 -1 10/-2=-5
0 S2 10
1
-9 9 18
Zj 270
0
Cj - Z j 15 0 -18
0
Pivot Column
The solution in the above case is not optimal because not all Cj - Zj entries are 0 or
negative, as required in a maximization problem. The next variable to enter the
solution should be X1.To determine which variable will leave the solution, we
examine the ratios of the quantity column numbers to their corresponding numbers
in the X1 or pivot column. Since both pivot column numbers are negative, an
unbounded solution is indicated.
5. Degeneracy
/Tie for leaving basic variable (key row)/
21
If there is a tie for the smallest ratio, this is a signal that degeneracy exists.
Degeneracy can occur right in the first (initial tableau).This normally happens when
the number of constraints is less than the number of variables in the objective
function. Problem can be overcome by trial and error method.
5 8 2 0
Cj
0 0
X1 X2 X3 S1 Q RR
SV
S2 S3
1/4 1 1 -2 =40
8 X2 10
0 0 20/4=5 Tie for the smallest
4 0 1/3 -1 ratio
0 S2 20 indicates degeneracy.
1 0 10/2=5
2 0 2 2/5
0 S3 10
0 1
2 8 8 16
Zj 80
0 0
Cj - Z j 3 0 -6 -16
0 0 Degeneracy
could lead to a situation known as cycling, in which the simplex algorithm
alternatives back and forth between the same non-optimal solutions, i.e, it puts a
new variable in, then takes it out in the next tableau, puts it back in ,and so on.
One simple way of dealing with the issue is to select either row (S2 or S3 in this
case) arbitrary. If we are unlucky and cycling does occur, we simply go back and
select the other row.
Remark
When there is a tie between a slack and artificial variable to leave the basis, the
preference shall be given to artificial variable to leave the basis and there is no
need to apply the procedure for resolving such cases.
22
3 2 0
Cj
0
X1 X2 S1
SV Q
S2
3/2 1 1
2 X2 6
0
1 0 1/2
0 S2 3
1
3 2 2
Zj 12
0
Cj - Z j 0 0 -2
0 MaxZ=3X1+2X2
X1=0, X2=6, S2=3 and MaxZ=12 or: X1=3, X2=3/2 and MaxZ=12
The Cj - Zj value of the Non-basic variable (X1) is 0.Thus, there is alternative optimal
solution.
Exercise:
1. Solve the following LPP by the simplex algorithm
Min Z=6x1 +8x2
Subject to:
x1+ 2x2 > 80
3x1+ x2 > 75
x1, x2 >0
What are the values of the basic variables at each iteration?
Which are the non-basic variables at each iteration?
Ans:X1=14, X2=33, and MinZ=221
23
Cj
X1 X2 X3 S1
SV Q
S2 S3
0 1 1 -2
5 X3 5
0 0
1 -3 0 0
6 X1 12
0 1
0 2 0 1
0 S2 10
1 -1
6 -13 5 5
Zj 97
0 21
What special
Cj - Z j 0 16 0 -5
condition
0 -21
exists as you
improves the profit and move to the next iteration? Proceed to solve the problem
for optimal solution
Ans: Degeneracy; X1=27, X2=5, X3=0, and
MaxZ=$177
3. Covert the following constraints and objective function into the standard form for
use in the simplex method
Min Z=4x1 +x2
Subject to:
3x 1+ x2 = 3
4x1+ 3x2 > 6
x1+ 2x2 < 3
x1, x2 >0
Answer:
Min.Z=4x1 +x2 + 0 s1 +0 s2+ M A1+M A3
St:
3x1+ x2 + A1 =3
4x1+ 3x2 -s1 +A2 =6
x1+ 2x2 + s2 =3
All Variables >0
4. Solve the following LPP using simplex method
MaxZ=9x1 +7x2
Subject to:
2x1+ x2 < 40
24
x1+ 3x2 < 30
x1, x2 >0
Ans: X1=18, X2=4, and MaxZ=$190
5. Solve the following LPP to show that it has alterative optimal solutions.
a. MaxZ=6x1 +3x2 Ans: i. X1=4, X2=0, and MaxZ=24
Subject to: ii.X1=5/2, X2=3, and MaxZ=24
2x1+ x2 < 8
3 x1+ 3x2 < 18
x2 < 3
x1, x2 >0
b MinZ=2x1 +8x2 Ans: i. X1=32/6, X2=10/6, and MinZ=24
Subject to: ii.X1=12, X2=0, and MinZ=24
5x1+ x2 > 10
2x1+ 2x2 > 14
x1+ 4x2 > 14
x1, x2 >0
6. Solve the following LPP to show that it has unbounded solution.
a. MaxZ=-2x1 +3x2
Subject to:
x1 <5
2 x1-3x2 < 6
x1, x2 >0
b. MaxZ=3x1 +6x2
Subject to:
3x1+ 4x2 > 12
-2x1+ x2 < 4
x1, x2 >0
7. Solve the following LPP to show that it has no feasible solution.
a. MaxZ=-2x1 +3x2 Ans: X1=2, X2=0, A1=2 and MaxZ=4-2M
Subject to:
x1 - x2 > 4
x1+ x2 < 6
x1 <2
x1, x2 > 0
25