Problem Statement:
Maximize Z = 3x1 + 4x2
Subject to the constraints:
x1 + 2x2 ≤ 4
3x1 + 2x2 ≤ 6
x1, x2 ≥ 0 (Non-negativity constraint)
Problem Statement:
Minimize Z = 3x1 + 4x2
Subject to the constraints:
x1 + 2x2 ≥ 4
3x1 + 2x2 ≥ 6
x1, x2 ≥ 0 (Non-negativity constraint)
Problem Statement:
Maximize Z = 3x1 + 2x2
Subject to the constraints:
x1 + 2x2 ≤ 4
3x1 + 2x2 ≤ 6
x1, x2 ≥ 0 (Non-negativity constraint)
Problem Statement:
Maximize Z = 6x1 + 4x2
Subject to the constraints:
2x1 + 4x2 ≤ 4
4x1 + 8x2 ≥ 16
x1, x2 ≥ 0 (Non-negativity constraint)
Maximize Z = 5x1 + 3x2
Subject to the constraints:
3x1 + 5x2 ≤ 15
5x1 + 2x2 ≤ 10
x1, x2 ≥ 0
| Cj | 5 | 3 | 0 | 0 |
CB | Xb | b | x1 | x2 | x3 | x4 |
----------------------------------------------
0 | x3 | 15 | 3 | 5 | 1 | 0 |
0 | x4 | 10 | 5 | 2 | 0 | 1 |
Here:
| Cj | 5 | 3 | 0 | 0 |
CB | Xb | b | x1 | x2 | x3 | x4 |
----------------------------------------------
0 | x3 | 15 | 3 | 5 | 1 | 0 | (Row 1)
0 | x4 | 10 | 5 | 2 | 0 | 1 | (Row 2)
----------------------------------------------
Zj | | 0 | 0 | 0 | 0 |
Cj | | 5 | 3 | 0 | 0 |
Zj - Cj | | -5 | -3 | 0 | 0 |
Here, Zj - Cj row shows the difference between the calculated and actual costs. The most
negative value, -5 (in the x1 column), indicates that x1 should enter the basis.
To decide which variable to remove from the basis (x3 or x4), we compute the minimum ratio
of b values and the coefficients in the x1 column:
| Cj | 5 | 3 | 0 | 0 |
CB | Xb | b | x1 | x2 | x3 | x4 | min ratio
--------------------------------------------------------
0 | x3 | 15 | 3 | 5 | 1 | 0 | 15/3 = 5
0 | x4 | 10 | 5 | 2 | 0 | 1 | 10/5 = 2 → smallest ratio
As 2 is the smallest ratio, x4 is the outgoing variable, and x1 will replace x4 in the
basis.
| Cj | 5 | 3 | 0 | 0 |
CB | Xb | b | x1 | x2 | x3 | x4 |
----------------------------------------------
0 | x3 | 9 | 0 | 19/5 | 1 | -3/5 | (Row 1)
5 | x1 | 2 | 1 | 2/5 | 0 | 1/5 | (Row 2)
----------------------------------------------
Row 2 was divided by 5, and row 1 was updated using row 1 - 3 * (new row 2).
| Cj | 5 | 3 | 0 | 0 |
CB | Xb | b | x1 | x2 | x3 | x4 | min ratio
--------------------------------------------------------
0 | x3 | 9 | 0 | 19/5 | 1 | -3/5 | 45/19 → smallest ratio
5 | x1 | 2 | 1 | 2/5 | 0 | 1/5 | 10/2
--------------------------------------------------------
Zj | | 5 | 2 | 0 | 1 |
Cj | | 5 | 3 | 0 | 0 |
Zj - Cj | | 0 | -1 | 0 | 1 |
The next entering variable is x2 (as -1 is the most negative value in Zj - Cj), and the
outgoing variable is x3 (smallest ratio). We perform another pivot operation.
| Cj | 5 | 3 | 0 | 0 |
CB | Xb | b | x1 | x2 | x3 | x4 |
--------------------------------------------------------
3 | x2 | 45/19 | 0 | 1 | 5/19 |-3/19 | (Row 1) new
5 | x1 | 20/19 | 1 | 0 | -2/19 | 5/19 | (Row 2)
--------------------------------------------------------
Zj | | 5 | 3 | 5/19 | 16/19
Cj | | 5 | 3 | 0 | 0
Zj - Cj | | 0 | 0 | 5/19 | 16/19
Since there are no more negative values in the Zj - Cj row, the optimal solution has been
reached.
Maximize Z = 3x1 + 2x2 + 5x3
Subject to the constraints:
x1 + x2 + x3 ≤ 9
2x1 + 3x2 + 5x3 ≤ 30
2x1 - x2 - x3 ≤ 8
xi ≥ 0
| Cj | 3 | 2 | 5 | 0 | 0 | 0 |
CB | Xb | b | x1 | x2 | x3 | x4 | x5 | x6 |
----------------------------------------------
0 | x4 | 9 | 1 | 1 | 1 | 1 | 0 | 0 | (Row 1)
0 | x5 | 30 | 2 | 3 | 5 | 0 | 1 | 0 | (Row 2)
0 | x6 | 8 | 2 | -1 | -1 | 0 | 0 | 1 | (Row 3)
| Cj | 3 | 2 | 5 | 0 | 0 | 0 |
CB | Xb | b | x1 | x2 | x3 | x4 | x5 | x6 |
----------------------------------------------
0 | x4 | 9 | 1 | 1 | 1 | 1 | 0 | 0 | (Row 1)
0 | x5 | 30 | 2 | 3 | 5 | 0 | 1 | 0 | (Row 2)
0 | x6 | 8 | 2 | -1 | -1 | 0 | 0 | 1 | (Row 3)
----------------------------------------------
Zj | | 0 | 0 | 0 | 0 | 0 | 0 |
Cj | | 3 | 2 | 5 | 0 | 0 | 0 |
Zj - Cj | | -3 | -2 | -5 | 0 | 0 | 0 |
The most negative value in Zj - Cj is -5, so x3 enters the basis. We calculate the minimum
ratio to determine the exiting variable:
| Cj | 3 | 2 | 5 | 0 | 0 | 0 |
CB | Xb | b | x1 | x2 | x3 | x4 | x5 | x6 |
-------------------------------------------------------------------
0 | x4 | 3 | 3/5| 2/5| 0 | 1 | -1/5| 0 | (Row 1)
5 | x3 | 6 | 2/5| 3/5| 1 | 0 | 1/5| 0 | (Row 2)
0 | x6 | 14 | 12/5| -2/5| 0 | 0 | 1/5| 1 | (Row 3)
--------------------------------------------------------------------
| Cj | 3 | 2 | 5 | 0 | 0 | 0 |
CB | Xb | b | x1 | x2 | x3 | x4 | x5 | x6 |
---------------------------------------------------------------------
0 | x4 | 3 | 3/5| 2/5| 0 | 1 | -1/5| 0 | (Row 1)
5 | x3 | 6 | 2/5| 3/5| 1 | 0 | 1/5| 0 | (Row 2)
0 | x6 | 14 | 12/5| -2/5| 0 | 0 | 1/5| 1 | (Row 3)
---------------------------------------------------------------------
Zj | | 2 | 3 | 5 | 0 | 1 | 0 |
Cj | | 3 | 2 | 5 | 0 | 0 | 0 |
Zj - Cj | | -1 | 1 | 0 | 0 | 1 | 0 |
The most negative value in Zj - Cj is -1, so x1 enters the basis. We calculate the minimum
ratio to determine the exiting variable:
| Cj | 3 | 2 | 5 | 0 | 0 | 0 |
CB | Xb | b | x1 | x2 | x3 | x4 | x5 | x6 |
-------------------------------------------------------------------
3 | x1 | 5 | 1 | 2/3| 0 | 5/3 | -1/3| 0 | (Row 1) new
5 | x3 | 4 | 0 | 1/3| 1 | -2/3 | 1/3| 0 | (Row 2)
0 | x6 | 2 | 0 | -2 | 0 | -4 | 1 | 1 | (Row 3)
--------------------------------------------------------------------
Zj - Cj | | 0 | 5/3| 0 | 5/3| 2/3| 0 |
As now all Zj - Cj values are postive, hence we have our optimal solution
The Big M Method is an approach used to solve linear programming problems (LPP) involving artificial variables when the problem includes greater-than-or-equal-to (≥) or equality (=) constraints. It allows converting such constraints into a standard form suitable for solving using the Simplex method.
Min Z = x1 + x2
Constraints:
2x1 + x2 ≥ 4
x1 + 7x2 ≥ 7
x1 ≥ 0
| Cj | -1 | -1 | 0 | 0 | -M | -M |
CB | Xb | b | x1 | x2 | x3 | x4 | x5 | x6 |
------------------------------------------------------------------------
-M | x5 | 4 | 2 | 1 | -1 | 0 | 1 | 0 | (Row 1)
-M | x6 | 7 | 1 | 7 | 0 | -1 | 0 | 1 | (Row 2)
------------------------------------------------------------------------
Zj | | -3M | -8M | M | M | -M | -M |
Cj | | -1 | -1 | 0 | 0 | 0 | 0 |
Zj - Cj | | -3M+1 | -8M+1 | M | M | 0 | 0 |
Since M is a large value, suppose it is 100, then the most negative value will be -8M+1. So
in this column, x2 is the entering variable.
| Cj | -1 | -1 | 0 | 0 | -M
CB | Xb | b | x1 | x2 | x3 | x4 | x5
---------------------------------------------------------------
-M | x5 | 3 | 13/7 | 0 | -1 | 1/7 | 1 (Row 1)
-1 | x2 | 1 | 1/7 | 1 | 0 | -1/7 | 0 (Row 2) new
---------------------------------------------------------------
Zj | |(-13M-1)/7 | -1 | M |(-M+1)/7 | -M
Cj | | -1 | -1 | 0 | 0 | 0
Zj - Cj | |(-13M-8)/7 | 0 | M |(-M+1)/7 | 0
Here, (-13M-8)/7 is the most negative, which makes x1 the entering variable.
| Cj | -1 | -1 | 0 | 0
CB | Xb | b | x1 | x2 | x3 | x4
---------------------------------------------------
-1 | x1 | 21/13 | 1 | 0 | -7/13 | 1/13 (Row 1) new
-1 | x2 | 10/13 | 0 | 1 | 1/13 | -2/13 (Row 2)
----------------------------------------------------
Zj | | -1 | -1 | 6/13 | 1/13
Cj | | -1 | -1 | 0 | 0
Zj - Cj | | 0 | 0 | 6/13 | 1/13
Now, as all Zj - Cj values are ≥ 0, we have found our optimal solution.
The Two-Phase Method is used to solve Linear Programming Problems (LPP) when the problem involves artificial variables, typically in the case of equality constraints or greater-than-or-equal-to (≥) constraints. It ensures that a feasible solution is found even when such variables are introduced. The method is divided into two phases:
Min Z = x1 + x2
Constraints:
2x1 + x2 ≥ 4
x1 + 7x2 ≥ 7
x1 ≥ 0
| Cj | 0 | 0 | 0 | 0 | -1 | -1 |
CB | Xb | b | x1 | x2 | x3 | x4 | x5 | x6 |
------------------------------------------------------------------------
-1 | x5 | 4 | 2 | 1 | -1 | 0 | 1 | 0 | (Row 1)
-1 | x6 | 7 | 1 | 7 | 0 | -1 | 0 | 1 | (Row 2)
------------------------------------------------------------------------
Zj | | -3 | -8 | 1 | 1 | -1 | -1 |
Cj | | 0 | 0 | 0 | 0 | -1 | -1 |
Zj - Cj | | -3 | -8 | 1 | 1 | 0 | 0 |
The most negative value will be -8. So
in this column, x2 is the entering variable.
| Cj | 0 | 0 | 0 | 0 | -1
CB | Xb | b | x1 | x2 | x3 | x4 | x5
---------------------------------------------------------------
-1 | x5 | 3 | 13/7 | 0 | -1 | 1/7 | 1 (Row 1)
0 | x2 | 1 | 1/7 | 1 | 0 | -1/7 | 0 (Row 2) new
---------------------------------------------------------------
Zj | | -13/7 | -1 | 1 | -1/7 | -1
Cj | | 0 | 0 | 0 | 0 | -1
Zj - Cj | | -13/7 | -1 | 1 | -1/7 | 0
Here, -13/7 is the most negative, which makes x1 the entering variable.
| Cj | 0 | 0 | 0 | 0
CB | Xb | b | x1 | x2 | x3 | x4
---------------------------------------------------
0 | x1 | 21/13 | 1 | 0 | -7/13 | 1/13 (Row 1) new
0 | x2 | 10/13 | 0 | 1 | 1/13 | -2/13 (Row 2)
----------------------------------------------------
Zj | | 0 | 0 | 0 | 0
Cj | | 0 | 0 | 0 | 0
Zj - Cj | | 0 | 0 | 0 | 0
Now, as all Zj - Cj values are ≥ 0, so our phase 1 is ended
| Cj | -1 | -1 | 0 | 0
CB | Xb | b | x1 | x2 | x3 | x4
---------------------------------------------------
-1 | x1 | 21/13 | 1 | 0 | -7/13 | 1/13 (Row 1) new
-1 | x2 | 10/13 | 0 | 1 | 1/13 | -2/13 (Row 2)
----------------------------------------------------
Zj - Cj | | 0 | 0 | 6/13 | 1/13
Now, as all Zj-Cj values are >= 0, so we have found our optimal solution
Basic Feasible Solution (BFS):
Example Problem - Find the Initial BFS (Basic Feasible Solution) of the Following Transportation Problem:
| Warehouse
Factory | w1 | w2 | w3 | w4 | Capacity
----------------------------------------------------
F1 | 19 | 30 | 50 | 10 | 7
F2 | 70 | 30 | 40 | 60 | 9
F3 | 40 | 8 | 70 | 20 | 18
----------------------------------------------------
Warehouse | 5 | 8 | 7 | 14 |
Requirement |
Factory | w1 | w2 | w3 | w4 | Capacity
----------------------------------------------------
F1 | 19 (5) | 30 | 50 | 10 | 7-5=2
F2 | 70 | 30 | 40 | 60 | 9
F3 | 40 | 8 | 70 | 20 | 18
----------------------------------------------------
Requirement | 5-5=0 | 8 | 7 | 14 |
now we will remove the column 1
Factory | w2 | w3 | w4 | Capacity
----------------------------------------------------
F1 | 30(2) | 50 | 10 | 2-2=0
F2 | 30 | 40 | 60 | 9
F3 | 8 | 70 | 20 | 18
----------------------------------------------------
Requirement | 8-2=6 | 7 | 14 |
now we remove row 1
Factory | w2 | w3 | w4 | Capacity
----------------------------------------------------
F2 | 30(6) | 40 | 60 | 9-6=3
F3 | 8 | 70 | 20 | 18
----------------------------------------------------
Requirement | 6-6=0 | 7 | 14 |
now we remove column 1
Factory | w3 | w4 | Capacity
--------------------------------------------
F2 | 40(3) | 60 | 3-3=0
F3 | 70 | 20 | 18
--------------------------------------------
Requirement | 7-3=4 | 14 |
now we remove row 1
Factory | w3 | w4 | Capacity
-----------------------------------------------
F3 | 70(4) | 20(14) | 18-4-14=0
-----------------------------------------------
Requirement | 4-4=0 | 14-14=0 |
so finaly we have:
Factory | w1 | w2 | w3 | w4 | Capacity
----------------------------------------------------------------
F1 | 19 (5) | 30(2) | 50 | 10 | 7
F2 | 70 | 30(6) | 40(3) | 60 | 9
F3 | 40 | 8 | 70(4) | 20(14) | 18
----------------------------------------------------------------
Requirement | 5 | 8 | 7 | 14 |
Now we will find its transportation cost:
Solving the Same Question Using the Least Cost Method
Factory | w1 | w2 | w3 | w4 | D
-------------------------------------------------
F1 | 19 | 30 | 50 | 10 | 7
F2 | 70 | 30 | 40 | 60 | 9
F3 | 40 | 8(8) | 70 | 20 | 18-8=10
-------------------------------------------------
S | 5 | 8-8=0 | 7 | 14 | 34
Now, we remove the w2 column.
Factory | w1 | w3 | w4 | D
-------------------------------------------------
F1 | 19 | 50 | 10(7) | 7-7=0
F2 | 70 | 40 | 60 | 9
F3 | 40 | 70 | 20 | 10
-------------------------------------------------
S | 5 | 7 | 14-7=7 | 34
Now, we remove row 1.
Factory | w1 | w3 | w4 | D
-----------------------------------------
F2 | 70 | 40 | 60 | 9
F3 | 40 | 70 | 20(7) | 10-7=3
-----------------------------------------
S | 5 | 7 | 7-7=0 | 34
Now, we remove the w4 column.
Factory | w1 | w3 | D
-------------------------------
F2 | 70 | 40(7) | 9-7=2
F3 | 40 | 70 | 3
-------------------------------
S | 5 | 7-7=0 |
Now, we remove the w3 column.
Factory | w1 | D
-----------------------
F2 | 70(2) | 2-2=0
F3 | 40(3) | 3-3=0
-----------------------
S | 5-2-3=0 |
So finally, we have:
Factory | w1 | w2 | w3 | w4
----------------------------------------------
F1 | 19 | 30 | 50 | 10(7)
F2 | 70(2) | 30 | 40(7) | 60
F3 | 40(3) | 8(8) | 70 | 20(7)
The number of allocations should be m + n - 1:
Reference