Two Phase Method

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

Two Phase Simplex Method

Consider the given linear programming (LP) problem.


Maximise P=x +5 y
subject to 3 x+ 4 y ≤ 6

x +3 y ≥ 2x , y ≥ 0

Phase 1

Introducing slack variable, S1, surplus variables, S2and artificial variable, A1:
Maximize P=– A 1 3 x+ 4 y + S1 =6

x +3 y−S2 + A1=2x , y , S 1 , S2 , A 1 ≥ 0

Cj 0 0 0 0 −1
CB Basis x y S1 S2 A1 Solution Replacement
variables, B values, b b
ratio,
y
0 S1 3 4 1 0 0 6 6
=1.5
4
−1 A1 1 3 0 −1 1 2 2
=0.6667
3
Pj −1 −3 0 1 −1 −2
P¿ ¿ −1 −3 0 1 0

The pivot element is 3. Replace the leaving basis variable, A1 with the entering variable, y .
Cj 0 0 0 0 −1
CB Basis x y S1 S2 A1 Solution
variables, B values, b
0 S1 5 0 1 4 −4 10 R1 (new) → R 1(old )−4 R2 (new)
3 3 3 3
0 y 1 1 0 −1 1 2
1
3 3 3 3 R2 (new) → R 2 (old)
3
Pj 0 0 0 0 0 0
P¿ ¿ 0 0 0 0 1

Phase 2
We eliminate the artificial variables and change the objective function for the original which is
P=x +5 y +0 S1 +0 S 2.
Cj 1 5 0 0
CB Basis x y S1 S2 Solution Replacement
variables, B values, b b
ratio,
y
0 S1 5 0 1 4 10 10 4
÷ =2.5
3 3 3 3 3
5 y 1 1 0 −1 2 2 −1
÷( )=−2
3 3 3 3 3
Pj 5 5 0 −5 10
3 3 3
Pi−C j 2 0 0 −5
3 3

4
The pivot element is . Replace the leaving basis variable, S1 with the entering variable, S2 .
3
Cj 1 5 0 0
CB Basis x y S1 S2 Solution
variables, values,
B b 3
0 S2 1.25 0 0.75 1 2.5 R1 (new) → R ( old)
4 2
5 y 0.75 1 0.25 0 1.5 1
R2 (new) → R 2 (old)+ R (new)
Pj 3.75 5 1.25 0 7.5 3 1
Pi−C j 2.75 0 1.25 0

Since all Pi−C j ≥ 0, optimal solution is arrived with value of variables as x=0 and y=1.5
and the maximum of P is7.5.

Algorithm Example
Step 1 Formulate the mathematical model of Maximize: z=2 x+ 5 y
the given linear programming (LP) Subject to 2 x+ y ≤ 5
problem. x +2 y ≥ 4
x , y ≥0
Step 2 Convert LP problem into canonical Adding slack variable, S1, surplus
form by adding slack, surplus and variables, S and artificial variable, A :
2 1
artificial variables for each constraint.
2 x+ y + S 1=5
Form a new objective function by
x +2 y −S 2 + A 1=4
assigning zero to every original
z=0 x +0 y +0 S 1 +0 S 2 +(– A 1)
variable (including slack and surplus
variables) and −1 to each of the
artificial variables.
Step 3 Phase 1: eg. R1(new)=R1(old) ÷3 eg.
a) Construct a simplex table. R2(new)=R2(old) -2 R1(new)
b) Select the pivot column.
i. For maximization case:
- If all z_j-c_j>0, then the current
basic feasible solution is the
optimal solution.
- In z_j-c_j<0, then a column with
the smallest value of z_j-c_j is the
pivot column.

ii. For minimization case:


- If all z_j-c_j<0, then the current
basic feasible solution is the
optimal solution.
- In z_j-c_j>0, then a column with
the largest value of c_j-z_j is the
pivot column.

c) Select the pivot row.


Find the ratio by dividing the
values of b column by the positive
value of pivot column. The row
with minimum ratio is the pivot row
and corresponding variable would
be the leaving basis variable.

d) Select the pivot element.


The intersection element of pivot
row and pivot column is the pivot
element.

e) Determine the new solution.


Perform row operations to make
the pivot element equal to 1 and
the remaining elements in the pivot
column equal to zero.

f) The solution at the end of Phase 1


is the initial basic feasible solution
for Phase 2.
Step 4 Phase 2:
a) Use the original objective
function, and coefficient of
artificial variable is 0 (so
artificial variable is removed
from the calculation process).
b) Repeat the procedure in phase
1 until all the values of
z j −c j ≥0  (for Maximization

case) or  z j −c j ≤0  (for


Minimization case).
Step 1 Phase-1 eg. Max Z = - A1 - A2

a. Form a new objective function by


assigning zero to every original
variable (including slack and surplus
variables) and −1 to each of the
artificial variables.

b. Using simplex method, try to


eliminate the artificial varibles from
the basis.

c. The solution at the end of Phase 1


is the initial basic feasible solution
for Phase 2.
Step 2 Phase-2

a. The original objective function is


used and coefficient of artificial
variable is 0 (so artificial variable is
removed from the calculation
process).
b. Then simplex algorithm is used to
find optimal solution.

Two Phase Simplex Method


Consider the above linear programming (LP) problem. First, let us introduce the slack,
surplus and artificial variables.
Maximize P=0 x +0 y +0 S1 +0 S2 +( – A1 )
P=– A 1
Subject to 3 x+ 4 y + S1 =6
x +3 y−S2 + A1=2

x , y , S 1 , S2 , A 1 ≥ 0

where S1 is a slack variable, S2 is a surplus variable and A1 is artificial variable.

Phase 1
Iteration-1 Cj 0 0 0 0 −1
Basic CB Solution x y S1 S2 A1 Minimum
variables values Ratio
B XB XB
y
S1 0 6 3 4 1 0 0 6
=1.5
4
A1 −1 2 1 3 0 −1 1 2
=0.6667
3
P=−2 Pj −1 −3 0 1 −1
C B x+C B x
Pi−C j −1 −3 0 1 0

The pivot element is 3. So, the entering variable is y and the leaving basis variable is A1.

Iteration-2 Cj 0 0 0 0
Basic CB Solution x y S1 S2
variables values
B XB

R1 (new)=R1 (old )−4 R2 (new)

R2 (new)=R2 (old)÷3
S1 0 10 5 0 1 4
3 3 3
y 0 2 1 1 0 −1
3 3 3
P=0 Pj 0 0 0 0

Pi−C j 0 0 0 0

Since all Pi−C j ≥ 0, hence optimal solution is arrived with value of variables as x=0 and

2
y= . The maximum of P is 0 .
3

Phase 2
We eliminate the artificial variables and change the objective function for the original which is
P=x +5 y +0 S1 +0 S 2

Iteration-1 Cj 1 5 0 0
Basic CB Solution x y S1 S2 Minimum Ratio,
variables, B values, X B
XB
y
S1 0 10 5 0 1 4 10 4
÷ =2.5
3 3 3 3 3
y 5 2 1 1 0 −1
-
3 3 3
10 Pj 5 5 0 −5
P=
3 3 3
C B x+C B x
Pi−C j 2 0 0 −5
3 3
4
The pivot element is . So, the entering variable is S2 and the leaving basis variable is S1.
3

Iteration-2 Cj 1 5 0 0
Basic CB Solution x y S1 S2
variables values
B XB
S2 0 2.5 1.25 0 0.75 1
y 5 1.5 0.75 1 0.25 0
P=¿7.5 Pj 3.75 5 1.25 0
C B x+C B x
Pi−C j 2.75 0 0 0
5
R1 (new)=R1 (old)÷
3
1
R2 (new)=R2 (old)+ R1 (new)
3

Since all Pi−C j ≥ 0, hence optimal solution is arrived with value of variables as x=0 and
y=1.5 . The maximum of P is 7.5.

You might also like