Home > Operation Research > Two-Phase method example

3. Two-Phase method example ( Enter your problem )
  1. Algorithm & Example-1 (using `Z`-row method)
  2. Example-2 (using `Z`-row method)
  3. Example-3 (using `Z`-row method)
  4. Infeasible solution example (using `Z`-row method)
  5. Algorithm & Example-1 (using `Z_j-C_j` method)
  6. Example-2 (using `Z_j-C_j` method)
  7. Example-3 (using `Z_j-C_j` method)
  8. Infeasible solution example (using `Z_j-C_j` method)
  9. Algorithm & Example-1 (using `C_j-Z_j`method)
  10. Example-2 (using `C_j-Z_j`method)
  11. Example-3 (using `C_j-Z_j`method)
  12. Infeasible solution example (using `C_j-Z_j`method)
Other related methods
  1. Formulate linear programming model
  2. Graphical method
  3. Simplex method (BigM method)
  4. Two-Phase method
  5. Primal to dual conversion
  6. Dual simplex method
  7. Integer simplex method
  8. Branch and Bound method
  9. 0-1 Integer programming problem
  10. Revised Simplex method

10. Example-2 (using `C_j-Z_j`method)
(Previous example)
12. Infeasible solution example (using `C_j-Z_j`method)
(Next example)

11. Example-3 (using `C_j-Z_j`method)





Find solution using Two-Phase method
MAX Z = 5x1 + 8x2
subject to
3x1 + 2x2 >= 3
x1 + 4x2 >= 4
x1 + x2 <= 5
and x1,x2 >= 0;


Solution:
Problem is
Max `Z``=````5``x_1`` + ``8``x_2`
subject to
```3``x_1`` + ``2``x_2``3`
`````x_1`` + ``4``x_2``4`
`````x_1`` + ````x_2``5`
and `x_1,x_2 >= 0; `


-->Phase-1<--

The problem is converted to canonical form by adding slack, surplus and artificial variables as appropiate

1. As the constraint-1 is of type '`>=`' we should subtract surplus variable `S_1` and add artificial variable `A_1`

2. As the constraint-2 is of type '`>=`' we should subtract surplus variable `S_2` and add artificial variable `A_2`

3. As the constraint-3 is of type '`<=`' we should add slack variable `S_3`

After introducing slack,surplus,artificial variables
Max `Z``=`` - ````A_1`` - ````A_2`
subject to
```3``x_1`` + ``2``x_2`` - ````S_1`` + ````A_1`=`3`
`````x_1`` + ``4``x_2`` - ````S_2`` + ````A_2`=`4`
`````x_1`` + ````x_2`` + ````S_3`=`5`
and `x_1,x_2,S_1,S_2,S_3,A_1,A_2 >= 0`


Tableau-1`C_j``0``0``0``0``0``-1``-1`
`C_B``"Basis"``x_1``x_2``S_1``S_2``S_3``A_1``A_2``RHS``"Ratio"=(RHS)/(x_2)`
`R_1` `-1``A_1``3``2``-1``0``0``1``0``3``(3)/(2)=1.5`
`R_2` `-1``A_2``1``(4)``0``-1``0``0``1``4``(4)/(4)=1``->`
`R_3` `0``S_3``1``1``0``0``1``0``0``5``(5)/(1)=5`
`Z_j``-4``-6``1``1``0``-1``-1``Z=-7`
`C_j-Z_j``4``6``uarr``-1``-1``0``0``0`


Most Positive `C_j-Z_j` is `6`. So, the entering variable is `x_2`.

Minimum ratio is `1`. So, the leaving basis variable is `A_2`.

`:.` The pivot element is `4`.

Entering `=x_2`, Departing `=A_2`, Key Element `=4`
`R_2`(new)`= R_2`(old) `-: 4`
`x_1``x_2``S_1``S_2``S_3``A_1``A_2``RHS`
`R_2`(old) = `1``4``0``-1``0``0``1``4`
`R_2`(new)`= R_2`(old) `-: 4``0.25``1``0``-0.25``0``0``0.25``1`
`R_1`(new)`= R_1`(old) - `2 R_2`(new)
`x_1``x_2``S_1``S_2``S_3``A_1``A_2``RHS`
`R_1`(old) = `3``2``-1``0``0``1``0``3`
`R_2`(new) = `0.25``1``0``-0.25``0``0``0.25``1`
`2 xx R_2`(new) = `0.5``2``0``-0.5``0``0``0.5``2`
`R_1`(new)`= R_1`(old) - `2 R_2`(new)`2.5``0``-1``0.5``0``1``-0.5``1`
`R_3`(new)`= R_3`(old) - `R_2`(new)
`x_1``x_2``S_1``S_2``S_3``A_1``A_2``RHS`
`R_3`(old) = `1``1``0``0``1``0``0``5`
`R_2`(new) = `0.25``1``0``-0.25``0``0``0.25``1`
`R_3`(new)`= R_3`(old) - `R_2`(new)`0.75``0``0``0.25``1``0``-0.25``4`


Tableau-2`C_j``0``0``0``0``0``-1``-1`
`C_B``"Basis"``x_1``x_2``S_1``S_2``S_3``A_1``A_2``RHS``"Ratio"=(RHS)/(x_1)`
`R_1` `-1``A_1``(2.5)``0``-1``0.5``0``1``-0.5``1``(1)/(2.5)=0.4``->`
`R_2` `0``x_2``0.25``1``0``-0.25``0``0``0.25``1``(1)/(0.25)=4`
`R_3` `0``S_3``0.75``0``0``0.25``1``0``-0.25``4``(4)/(0.75)=5.3333`
`Z_j``-2.5``0``1``-0.5``0``-1``0.5``Z=-1`
`C_j-Z_j``2.5``uarr``0``-1``0.5``0``0``-1.5`


Most Positive `C_j-Z_j` is `2.5`. So, the entering variable is `x_1`.

Minimum ratio is `0.4`. So, the leaving basis variable is `A_1`.

`:.` The pivot element is `2.5`.

Entering `=x_1`, Departing `=A_1`, Key Element `=2.5`
`R_1`(new)`= R_1`(old) `-: 2.5`
`x_1``x_2``S_1``S_2``S_3``A_1``A_2``RHS`
`R_1`(old) = `2.5``0``-1``0.5``0``1``-0.5``1`
`R_1`(new)`= R_1`(old) `-: 2.5``1``0``-0.4``0.2``0``0.4``-0.2``0.4`
`R_2`(new)`= R_2`(old) - `0.25 R_1`(new)
`x_1``x_2``S_1``S_2``S_3``A_1``A_2``RHS`
`R_2`(old) = `0.25``1``0``-0.25``0``0``0.25``1`
`R_1`(new) = `1``0``-0.4``0.2``0``0.4``-0.2``0.4`
`0.25 xx R_1`(new) = `0.25``0``-0.1``0.05``0``0.1``-0.05``0.1`
`R_2`(new)`= R_2`(old) - `0.25 R_1`(new)`0``1``0.1``-0.3``0``-0.1``0.3``0.9`
`R_3`(new)`= R_3`(old) - `0.75 R_1`(new)
`x_1``x_2``S_1``S_2``S_3``A_1``A_2``RHS`
`R_3`(old) = `0.75``0``0``0.25``1``0``-0.25``4`
`R_1`(new) = `1``0``-0.4``0.2``0``0.4``-0.2``0.4`
`0.75 xx R_1`(new) = `0.75``0``-0.3``0.15``0``0.3``-0.15``0.3`
`R_3`(new)`= R_3`(old) - `0.75 R_1`(new)`0``0``0.3``0.1``1``-0.3``-0.1``3.7`


Tableau-3`C_j``0``0``0``0``0``-1``-1`
`C_B``"Basis"``x_1``x_2``S_1``S_2``S_3``A_1``A_2``RHS``"Ratio"`
`R_1` `0``x_1``1``0``-0.4``0.2``0``0.4``-0.2``0.4`
`R_2` `0``x_2``0``1``0.1``-0.3``0``-0.1``0.3``0.9`
`R_3` `0``S_3``0``0``0.3``0.1``1``-0.3``-0.1``3.7`
`Z_j``0``0``0``0``0``0``0``Z=0`
`C_j-Z_j``0``0``0``0``0``-1``-1`


Since all `C_j-Z_j <= 0`

Hence, optimal solution is arrived with value of variables as :
`x_1=0.4,x_2=0.9`

Max `Z=0`

-->Phase-2<--

we eliminate the artificial variables and change the objective function for the original,
Max `Z=5x_1 + 8x_2 + 0S_1 + 0S_2 + 0S_3`

Tableau-1`C_j``5``8``0``0``0`
`C_B``"Basis"``x_1``x_2``S_1``S_2``S_3``RHS``"Ratio"=(RHS)/(S_2)`
`R_1` `5``x_1``1``0``-0.4``(0.2)``0``0.4``(0.4)/(0.2)=2``->`
`R_2` `8``x_2``0``1``0.1``-0.3``0``0.9``(0.9)/(-0.3)` (ignore, denominator is -ve)
`R_3` `0``S_3``0``0``0.3``0.1``1``3.7``(3.7)/(0.1)=37`
`Z_j``5``8``-1.2``-1.4``0``Z=9.2`
`C_j-Z_j``0``0``1.2``1.4``uarr``0`


Most Positive `C_j-Z_j` is `1.4`. So, the entering variable is `S_2`.

Minimum ratio is `2`. So, the leaving basis variable is `x_1`.

`:.` The pivot element is `0.2`.

Entering `=S_2`, Departing `=x_1`, Key Element `=0.2`
`R_1`(new)`= R_1`(old) `-: 0.2`
`x_1``x_2``S_1``S_2``S_3``RHS`
`R_1`(old) = `1``0``-0.4``0.2``0``0.4`
`R_1`(new)`= R_1`(old) `-: 0.2``5``0``-2``1``0``2`
`R_2`(new)`= R_2`(old) + `0.3 R_1`(new)
`x_1``x_2``S_1``S_2``S_3``RHS`
`R_2`(old) = `0``1``0.1``-0.3``0``0.9`
`R_1`(new) = `5``0``-2``1``0``2`
`0.3 xx R_1`(new) = `1.5``0``-0.6``0.3``0``0.6`
`R_2`(new)`= R_2`(old) + `0.3 R_1`(new)`1.5``1``-0.5``0``0``1.5`
`R_3`(new)`= R_3`(old) - `0.1 R_1`(new)
`x_1``x_2``S_1``S_2``S_3``RHS`
`R_3`(old) = `0``0``0.3``0.1``1``3.7`
`R_1`(new) = `5``0``-2``1``0``2`
`0.1 xx R_1`(new) = `0.5``0``-0.2``0.1``0``0.2`
`R_3`(new)`= R_3`(old) - `0.1 R_1`(new)`-0.5``0``0.5``0``1``3.5`


Tableau-2`C_j``5``8``0``0``0`
`C_B``"Basis"``x_1``x_2``S_1``S_2``S_3``RHS``"Ratio"=(RHS)/(S_1)`
`R_1` `0``S_2``5``0``-2``1``0``2``(2)/(-2)` (ignore, denominator is -ve)
`R_2` `8``x_2``1.5``1``-0.5``0``0``1.5``(1.5)/(-0.5)` (ignore, denominator is -ve)
`R_3` `0``S_3``-0.5``0``(0.5)``0``1``3.5``(3.5)/(0.5)=7``->`
`Z_j``12``8``-4``0``0``Z=12`
`C_j-Z_j``-7``0``4``uarr``0``0`


Most Positive `C_j-Z_j` is `4`. So, the entering variable is `S_1`.

Minimum ratio is `7`. So, the leaving basis variable is `S_3`.

`:.` The pivot element is `0.5`.

Entering `=S_1`, Departing `=S_3`, Key Element `=0.5`
`R_3`(new)`= R_3`(old) `-: 0.5`
`x_1``x_2``S_1``S_2``S_3``RHS`
`R_3`(old) = `-0.5``0``0.5``0``1``3.5`
`R_3`(new)`= R_3`(old) `-: 0.5``-1``0``1``0``2``7`
`R_1`(new)`= R_1`(old) + `2 R_3`(new)
`x_1``x_2``S_1``S_2``S_3``RHS`
`R_1`(old) = `5``0``-2``1``0``2`
`R_3`(new) = `-1``0``1``0``2``7`
`2 xx R_3`(new) = `-2``0``2``0``4``14`
`R_1`(new)`= R_1`(old) + `2 R_3`(new)`3``0``0``1``4``16`
`R_2`(new)`= R_2`(old) + `0.5 R_3`(new)
`x_1``x_2``S_1``S_2``S_3``RHS`
`R_2`(old) = `1.5``1``-0.5``0``0``1.5`
`R_3`(new) = `-1``0``1``0``2``7`
`0.5 xx R_3`(new) = `-0.5``0``0.5``0``1``3.5`
`R_2`(new)`= R_2`(old) + `0.5 R_3`(new)`1``1``0``0``1``5`


Tableau-3`C_j``5``8``0``0``0`
`C_B``"Basis"``x_1``x_2``S_1``S_2``S_3``RHS``"Ratio"`
`R_1` `0``S_2``3``0``0``1``4``16`
`R_2` `8``x_2``1``1``0``0``1``5`
`R_3` `0``S_1``-1``0``1``0``2``7`
`Z_j``8``8``0``0``8``Z=40`
`C_j-Z_j``-3``0``0``0``-8`


Since all `C_j-Z_j <= 0`

Hence, optimal solution is arrived with value of variables as :
`x_1=0,x_2=5`

Max `Z=40`




This material is intended as a summary. Use your textbook for detail explanation.
Any bug, improvement, feedback then Submit Here



10. Example-2 (using `C_j-Z_j`method)
(Previous example)
12. Infeasible solution example (using `C_j-Z_j`method)
(Next example)





Share this solution or page with your friends.
 
 
Copyright © 2026. All rights reserved. Terms, Privacy
 
 

.