Two Phase Method

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 45

The Two-Phase Simplex

Method
The Two-Phase Simplex Method
 For greater than or equal to constraint, the slack
variable has a negative co efficient
 Equality constraints do not have slack variables
 If either of constraint is part of the model, there is
no convenient IBFS and hence two phase method
is used

When a basic feasible solution (bfs) is not readily


available, the two-phase simplex method may be
used as an alternative to the big M method.
• In the two-phase simplex method, we add artificial va
riables to the same constraints as we did in big M met
hod. Then we find a bfs to the original LP by solving
the Phase I LP.
• In the Phase I LP, the objective function is to minimiz
e the sum of all artificial variables.
• At the completion of Phase I, we reintroduce the origi
nal LP’s objective function and determine the optimal
solution to the original LP.
The two-phase simplex method
• Step 1
Modify the constraints so that the right-hand side of each constraint is non
negative. This requires that each constraint with a negative right-hand s
ide be multiplied through by -1.
• Step 2
Identify each constraint that is now an = or ≥ constraint. In step 3, we wil
l add an the artificial variable to each of these constraints.
• Step 3
Convert each inequality constraint to standard form.
For ≤ constraint i, we add a slack variable si;
For ≥ constraint i, we add Surplus variable and artificial variable;

Constraint type Variable to be added


≥ + slack (s)
≤ - Surplus (s) + artificial (A)
= + Artificial (A)
The two-phase simplex method
• Step 4
For now, ignore the original LP’s objective function.
Instead solve an LP whose objective function is mi
n Z*=(sum of all the artificial variables). This is ca
lled the Phase I LP. The act of solving the phase I
LP will force the artificial variables to be zero.
The two-phase simplex method
Since each ai≥0, solving the Phase I LP will result in one of th
e following three cases:
• Case 1
The optimal value of Z* is greater than zero. In this case, the
original LP has no feasible solution.
• Case 2
The optimal value of Z* is equal to zero, and no artificial var
iables are in the optimal Phase I basis. In this case, we drop
all columns in the optimal Phase I tableau that correspond t
o the artificial variables. We now combine the original obje
ctive function with the constraints from the optimal Phase I
tableau. This yields the Phase II LP. The optimal solution to
the Phase II LP is the optimal solution to the original LP.
The two-phase simplex method
• Case 3
The optimal value of Z* is equal to zero and at least
one artificial variable is in the optimal Phase I basi
s. In this case, we can find the optimal solution to t
he original LP if at the end of Phase I we drop fro
m the optimal Phase I tableau all nonbasic artificial
variables and any variable from the original proble
m that has a negative coefficient in row 0 of the op
timal Phase I tableau.
Phase I and II feasible solutions
• Suppose the original LP is infeasible. Then the only way t
o obtain a feasible solution to the Phase I LP is to let at le
ast one artificial variable be positive. In this situation, Z*
>0 will result.
• On the other hand, if the original LP has a feasible solutio
n, this feasible solution is feasible in the Phase I LP and y
ields Z*=0. This means that if the original LP has a feasib
le solution, the optimal Phase I solution will have Z*=0.
Phase I
1. In this phase, we find an IBFS to the original
problem, for this all artificial variable are to be
driven to zero. To do this an artificial objective
function (Z*) is created which is the sum of all
artificial variables. The new objective function is
then subjected to the constraints of the given
original problem using the simplex method. At the
end of Phase I, three cases arises
A. If the minimum value of Z*=0, and no artificial
variable appears in the basis at a positive level then
the given problem has no feasible solution and
procedure terminates.
9
B. If the minimum value of Z*=0, and no artificial
variable appears in the basis, then a basic feasible
solution to the given problem is obtained.
C. If the minimum value of the Z*=0 and one or
more artificial variable appears in the basis at
zero level, then a feasible solution to the original
problem is obtained. However, we must take care
of this artificial variable and see that it never
become positive during Phase II computations.

10
Phase II
 When Phase I results in (B) or (C), we go on for Phase
II to find optimum solution to the given LP problem.
The basic feasible solution found at the end of Phase I
now used as a starting solution for the original LP
problem. Mean that find table of Phase I becomes
initial table for Phase II in which artificial (auxiliary)
objective function is replaced by the original objective
function. Simplex method is then applied to arrive at
optimum solution.

11
 X1=3/2
 X3=3
Hence Z= -4X1 -3X2 -9X3
Z= -4(1.5)-3(3)-9(0)
Z= -15

12
Example
Min Z =2x1+3x2
s.t. 1/2x1+1/4x2≤4
x1+ 3x2≥20
x 1+ x2=10
x1,x2≥0
Example
• Solution
As in the Big M method, step 1-3 transform the cons
traints into

1/2 x1+1/4x2+s1 =4
x1+ 3x2 -S2+a2 =20
x1+ x2 +a3 =10
Example 5
Step 4 yields the following Phase I LP:

min Z*= a2+a3


s.t. 1/2 x1+1/4x2+s1 =4
x1+ 3x2 -S2+a2 =20
x1 + x2 +a3 =10
This set of equations yields a starting bfs for Phase I
(s1=4,a2=20,a3=10).
Example
• Note:
The row 0 for this tableau (Z*-a2-a3=0) contains the basi
c variables a2 and a3.as in the Big M method, a2 and a3
must be eliminated from row 0 before we can solve P
hase I.
To eliminate a2 and a3 from row 0,
Row 0: Z* -a2-a3 =0
+Row 2: x1+3x2-S2+a2 =20
+Row 3: x1+ x2 +a3=10
=New row 0: w’ +2x1+4x2-S2 =30
Example
Combining the new row 0 with the Phase I constrain
ts yields the initial Phase I tableau:
Initial Phase I tableau for
Basic
Z* x1 x2 s1 S2 A2 A3 RHS variable ratio
1 2 4 0 -1 0 0 30 W’=30

0 ½ ¼ 1 0 0 0 4 s1=4 16

0 1 ③ 0 -1 1 0 20 a2=20 20/3*

0 1 1 0 0 0 1 10 a3=10 10

Note: Phase I problem is always a min problem, even if the


original LP is a max problem.
Example
After performing the necessary ero’s, we obtain the
second tableau.
Phase I tableau after one iteration
Basic
Z* x1 x2 s1 S2 A2 A3 RHS variable ratio
1 2/3 0 0 1/3 -4/3 0 10/3 W’=10/3

0 5/12 0 1 1/12 -1/12 0 7/3 s1=7/3 28/5

0 1/3 1 0 -1/3 1/3 0 20/3 x2=20/3 20

0 2/3 0 0 1/3 -1/3 1 10/3 a3=10/3 5*


Example
After performing the necessary ero’s, we obtain the
third tableau.
Phase I tableau after two iteration
Basic
Z* x1 x2 s1 S2 A2 A3 RHS variable

1 0 0 0 0 -1 -1 0 W’=0

0 0 0 1 -1/8 1/8 -5/8 ¼ s1=1/4

0 0 1 0 -1/2 ½ -1/2 5 x2=5

0 1 0 0 1/2 -1/2 3/2 5 x1=5


Example
Since Z*=0, Phase I has been concluded. The basic fe
asible solution s1=1/4,x2=5,x1=5 has been found.
Since no artificial variables are in the optimal Phase I
basis, the problem is an example of Case 2.
We now drop the columns for the artificial variables
a2 and a3 and reintroduce the original objective fu
nction.
min z=2x1+3x2 or z-2x1-3x2=0
Example
Since x1 and x2 are both in the optimal Phase I basis, they
must be eliminated from the Phase II row 0.
Phase II row 0: z-2x1-3x2 =0
+3(row 2): 3x2-3/2S2=15
+2(row 3): 2x1 +S2=10
= New Phase II row 0: z -1/2S2=25
We now begin Phase II with the following set of equations:
min z -1/2S2=25
s.t s1-1/8S2=1/4
x2 -1/2S2=5
x1 +1/2S2=5
This is optimal.
The optimal solution is z=25 x1=5 x2=5 s1=1/4 S2=0.
Example 2
• We modify problem that 36 mg of vitamin C are
required. Then, we know that this problem is in
feasible. We begin with the original problem:
min z=2x1+3x2
s.t. 1/2x1+1/4x2≤4 (sugar constraint)
x1+ 3x2≥36 (vitamin C constraint)
x1+ x2=10 (10 oz in bottle of Oranj)
x1,x2≥0
Example
• Solution
After completing steps 1-4 of the two-phase simplex
, we obtain the following Phase I problem:
min Z*= a2+a3
s.t. 1/2 x1+1/4x2+s1 =4
x1+ 3x2 -S2+a2 =36
x1+ x2 +a3 =10
From this set of equations, we see that the initial Phase I
bfs is s1=4,a2=36 and a3=10.
Example
Since the basic variables a2 and a3 occur in the Phas
e I objective function, they must be eliminated fro
m the Phase I row 0.
Row 0: Z* -a2-a3 =0
+Row 2: x1+3x2-S2+a2 =36
+Row 3: x1+ x2 +a3=10
=New row 0: w’ +2x1+4x2-S2 =46
Example
With the new row 0, the initial Phase I tableau is:
Basic
Z* x1 x2 s1 S2 a2 a3 rhs variable ratio

1 2 4 0 -1 0 0 46 W’=46

0 ½ ¼ 1 0 0 0 4 s1=4 16

0 1 3 0 -1 1 0 36 a2=36 12

0 1 ① 0 0 0 1 10 a3=10 10*

x2 to enter, a3 to leave the basis, the new tableau is:


Basic
Z* x1 x2 s1 S2 a2 a3 rhs variable

1 -2 0 0 -1 0 -4 6 W’=6

0 ¼ 0 1 0 0 -1/4 3/2 s1=3/2

0 -2 0 0 -1 1 -3 6 a2=6

0 1 1 0 0 0 1 10 x2=10
Example
• Since no variable in row 0 has a positive coeffi
cient, this is an optimal Phase I tableau.
• Since the optimal value of Z* is 6>0, the origin
al LP must have no feasible solution.
Remarks
• As with the Big M method, the column for any
artificial variable may be dropped from future
tableaus as soon as the artificial variable leave
s the basis.
• The Big M method and Phase I of the twp-pha
se method make the same sequence of pivots.
The two-phase method does not cause round
off errors and other computational difficulties.
Example 3
Solve given LPP by Two-Phase Method

Max Z  5x1  4x2  3x3


Subject to 2x1  x2  6x3  20
6x1  5x2 10x3  76
8x1  3x2  6x3  50

28
 Add artificial variable to the first constraint and
slack variable to second and third constraints.
 Phase I
 Assigning a cost 1 to artificial variable and cost o
to other variables, the objective function of the
auxiliary
LPP
Min
is Max 
Z*  0x1  0x2  0x3 - A1
Min Z * 0x1  0x2  0x3  A1 
0 Subject to 2x1  x2  6x3  A1 
20 6x1  5x2 10x 3  S1 
76
8x1  3x2  6x3  S2  50
29
CJ 0 0 0 0 0 -1
Basis CB XB X1 X2 X3 S1 S2 A1
Varia
ble
A1 -1 20 2 1 -6 0 0 1
S1 0 76 6 5 10 1 0 0
S2 0 50 8 -3 6 0 1 0

30
CJ 0 0 0 0 0 -1
Basis CB XB X1 X2 X3 S1 S2 A1 θ
Variabl
e
A1 -1 20 2 1 -6 0 0 1 10
S1 0 76 6 5 10 1 0 0 76/6
S2 0 50 8 -3 6 0 1 0 50/8
ZJ -2 -1 6 0 0 -1
CJ- ZJ 2 1 -6 0 0 0

X1 is entering variable and S2 is leaving


variable
31
Row Calculations
 New R3=Old R3/8
 New R1=New R3*2-Old R1
 New R2=NewR3*6-Old
R2 CJ 0 0 0 0 0 -1
Basis CB XB X1 X2 X3 S1 S2 A1 θ
Variable
A1 -1 7.5 0 1.75 -7.5 0 -1/4 1 4.28
S1 0 77/2 0 29/4 11/2 1 -0.75 0 5.31
X1 is ente
X2 0 ing
50/8 iab
1 e -3/8
and 16/8 0 g 1/8 bl0
is avi ---
r varZJ l 0 A-1.75 le7.5 n0 varia
1/4 e-1
CJ- ZJ 0 1.75 -7.5 0 -1/4 0

X2 is entering variable and A1 is leaving


variable 32
 Row Calculations
 New R1=Old R1/1.75
 New R2=New R1*29/4-Old R2
 New R3=NewR1*(3/8)+Old
R3
Basis CB XB X1 X2 X3 S1 S2
Variabl
e
X2 0 4.28 0 1 -4.28 0 -0.14
S1 0 7.47 0 0 36.53 0 0.765
X1 0 7.85 1 0 -0.86 0 0.073
ZJ 0 0 0 0 0
CJ-ZJ 0 0 0 0 0

As there is no artificial variable in the basis go to Phase


II 33
Phase II
Consider the final Simplex table of Phase I, consider
the actual cost associated with the original variables.
Delete the artificial variable A1 column from the
table as it is eliminated in Phase II.

Max Z  5x 1  4 x  3 x 3  0 S 1  0 S 2
M a x Z  5x 1  4 x  3 x 3  0 S 1  0 S 2 
0

34
CJ 5 -4 3 0 0
Basis CB XB X1 X2 X3 S1 S2
Variabl
e
X2 -4 4.28 0 1 -4.28 0 -0.14
S1 0 7.47 0 0 36.53 0 0.765
X1 5 7.85 1 0 -0.86 0 0.073
ZJ 5 -4 12.82 0 0.925
CJ-ZJ 0 0 -9.82 0 -0.925

35
 As the given problem is of maximization and all the
values in CJ-ZJ row are either zero or negative, an
optimal solution is reached and is given by
 X1=7.855
X2=4.28 and
Z=5X1-4X2+3X3
 Z=5(7.855)-4(4.28)+3(0)
= 22.15

36
Example 4
Solve by Two-Phase Simplex Method

Max Z  4x1  3x2  9x3


Subject to 2x1  4x2  6x3  15
6x1  x2  6x3  12
x1 , x 2 , x 3  0

37
 Add artificial variable to the first constraint and
slack variable to second and third constraints.
 Phase I
 Assigning a cost 1 to artificial variable and cost o to
other variables, the objective function of the auxiliary
LPP is
A new auxiliary linear programming problem

- A1 - A2
Min Z*  0x1  0x2  0x3 
Max
Min Z *  A1  A2 
0 1  4x2  6x3  S1  A1 15
2x
6x1  x2  6x3  S2  A2  12
38
Phase I
CJ 0 0 0 0 0 -1 -1
Basis CB XB X1 X2 X3 S1 S2 A1 A2
Variabl
e
A1 -1 15 2 4 6 -1 0 1 0
A2 -1 12 6 1 6 0 -1 0 1

39
 Row Calculations
 New Z*=R3+R1+R2
CJ 0 0 0 0 0 -1 -1
Basis CB XB X1 X2 X3 S1 S2 A1 A2 θ
Variab
l e
A1 -1 15 2 4 6 -1 0 1 O 15/6
A2 -1 12 6 1 6 0 -1 0 1 12/6
ZJ -8 -5 -12 1 0 -1 -1
CJ-ZJ 8 5 12 -1 -1 0 0

X3 is entering variable and A2 is leaving


variable
40
 Row Calculations
 New R2=Old R2/6
 New R1= New R2*6-Old
R1 CJ 0 0 0 0 0 -1
Basis CB XB X1 X2 X3 S1 S2 A1 θ
Variable
A1 -1 3 -4 3 0 -1 1 1 1
X3 0 2 1 1/6 1 0 -1/6 0 12
ZJ 4 -3 0 1 -1 -1
CJ-ZJ -4 3 0 -1 1 0

X2 is entering variable and A1 is leaving


variable 41
 Row Calculations
 New R1=Old R1/3
 New R2= New R1*(1/6)-Old R2

CJ 0 0 0 0 0
Basis CB XB X1 X2 X3 S1 S2
Variabl
e
X2 0 1 -4/3 1 0 -1/3 1/3
X3 0 11/6 11/9 0 1 1/18 -2/9
ZJ 0 0 0 0 0
CJ-ZJ 0 0 0 0 0
Optimality condition is satisfied as Z* is having
zero value
42
Phase II
 Original objective function is given as
 Consider the final Simplex table of Phase I, consider
the actual cost associated with the original variables.
Delete the artificial variable A1 column from the
table as it is eliminated in Phase II.

Max Z  4x1  3x2  9x3  0S1  0S2


Max Z  4x1  3x2  9x3  0S1  0S2
Subject to 2x1  4x2  6x3  0S1  15
6x1  x2  6x3  0S2  12
x 1, x 2 , x 3  0
43
Initial Basic Feasible Solution
CJ -4 -3 -9 0 0
Basis CB XB X1 X2 X3 S1 S2 θ
Variabl
e
X2 -3 1 -4/3 1 0 -1/3 1/3 9/4
X3 -9 11/6 11/9 0 1 1/18 -2/9 1.5
ZJ -7 -3 -9 -1/2 -1
CJ-ZJ 3 0 0 1/2 1

X1 is entering variable and X3 is leaving variable


44
 Row Calculations
New R2=Old R2/(11/9)
 New R1=New R2+Old
R1 CJ -4 -3 -9 0 0
Basis CB XB X1 X2 X3 S1 S2
Variabl
e
X2 -3 3 0 1 12/11 -3/11 13/33
X1 -4 3/2 1 0 9/11 1/22 -2/11
ZJ -4 -3 72/11 7/11 3/11
CJ-ZJ 0 0 -27/11 -7/11 -3/11
 As all the values in Z row are zero or negative,
the condition of optimality is reached.
45

You might also like