# Transportation Problem | Set 6 (MODI Method – UV Method)

There are two phases to solve the transportation problem. In the first phase, the initial basic feasible solution has to be found and the second phase involves optimization of the initial basic feasible solution that was obtained in the first phase. There are three methods for finding an initial basic feasible solution,

This article will discuss how to optimize the initial basic feasible solution through an explained example. Consider the below transportation problem.

**Solution:**

**Step 1:** Check whether the problem is balanced or not.

If the total sum of all the supply from sources **O1**, **O2**, and **O3** is equal to the total sum of all the demands for destinations **D1**, **D2**, **D3** and **D4** then the transportation problem is a balanced transportation problem.

**Note:** If the problem is not unbalanced then the concept of a dummy row or a dummy column to transform the unbalanced problem to balanced can be followed as discussed in this article.

**Step 2:** Finding the initial basic feasible solution.

Any of the three aforementioned methods can be used to find the initial basic feasible solution. Here, NorthWest Corner Method will be used. And according to the NorthWest Corner Method this is the final initial basic feasible solution:

Now, the total cost of transportation will be **(200 * 3) + (50 * 1) + (250 * 6) + (100 * 5) + (250 * 3) + (150 * 2) = 3700**.

**Step 3:** U-V method to optimize the initial basic feasible solution.

The following is the initial basic feasible solution:

– For U-V method the values **u _{i}** and

**v**have to be found for the rows and the columns respectively. As there are three rows so three

_{j}**u**values have to be found i.e.

_{i}**u**for the first row,

_{1}**u**for the second row and

_{2}**u**for the third row.

_{3}Similarly, for four columns four

**v**values have to be found i.e.

_{j}**v**,

_{1}**v**,

_{2}**v**and

_{3}**v**. Check the image below:

_{4}There is a separate formula to find **u _{i}** and

**v**,

_{j}**u**where

_{i}+ v_{j}= C_{ij}**C**is the cost value only for the allocated cell. Read more about it here.

_{ij}Before applying the above formula we need to check whether **m + n – 1 is equal to the total number of allocated cells** or not where **m** is the total number of rows and **n** is the total number of columns.

In this case m = 3, n = 4 and total number of allocated cells is 6 so m + n – 1 = 6. The case when m + n – 1 is not equal to the total number of allocated cells will be discussed in the later posts.

Now to find the value for u and v we assign any of the three u or any of the four v as 0. Let we assign **u _{1} = 0** in this case. Then using the above formula we will get

**v**as

_{1}= 3**u**(i.e.

_{1}+ v_{1}= 3**C**) and

_{11}**v**as

_{2}= 1**u**(i.e.

_{1}+ v_{2}= 1**C**). Similarly, we have got the value for

_{12}**v**so we get the value for

_{2}= 1**u**which implies

_{2}= 5**v**. From the value of

_{3}= 0**v**we get

_{3}= 0**u**which implies

_{3}= 3**v**. See the image below:

_{4}= -1Now, compute penalties using the formula **P _{ij} = u_{i} + v_{j} – C_{ij}** only for unallocated cells. We have two unallocated cells in the first row, two in the second row and two in the third row. Lets compute this one by one.

- For
**C**,_{13}**P**(here_{13}= 0 + 0 – 7 = -7**C**,_{13}= 7**u**and_{1}= 0**v**)_{3}= 0 - For
**C**,_{14}**P**_{14}= 0 + (-1) -4 = -5 - For
**C**,_{21}**P**_{21}= 5 + 3 – 2 = 6 - For
**C**,_{24}**P**_{24}= 5 + (-1) – 9 = -5 - For
**C**,_{31}**P**_{31}= 3 + 3 – 8 = -2 - For
**C**,_{32}**P**_{32}= 3 + 1 – 3 = 1

**The Rule:** If we get all the penalties value as zero or negative values that mean the optimality is reached and this answer is the final answer. But if we get any positive value means we need to proceed with the sum in the next step.

Now find the maximum positive penalty. Here the maximum value is 6 which corresponds to **C _{21}** cell. Now this cell is new basic cell. This cell will also be included in the solution.

**The rule for drawing closed-path or loop.** Starting from the new basic cell draw a closed-path in such a way that the right angle turn is done only at the allocated cell or at the new basic cell. See the below images:

Assign alternate plus-minus sign to all the cells with right angle turn (or the corner) in the loop with plus sign assigned at the new basic cell.

Consider the cells with a negative sign. Compare the allocated value (i.e. 200 and 250 in this case) and select the minimum (i.e. select 200 in this case). Now subtract 200 from the cells with a minus sign and add 200 to the cells with a plus sign. And draw a new iteration. The work of the loop is over and the new solution looks as shown below.

Check the total number of allocated cells is equal to (m + n – 1). Again find u values and v values using the formula **u _{i} + v_{j} = C_{ij}** where

**C**is the cost value only for allocated cell. Assign

_{ij}**u**then we get

_{1}= 0**v**. Similarly, we will get following values for

_{2}= 1**u**and

_{i}**v**.

_{j}Find the penalties for all the unallocated cells using the formula **P _{ij} = u_{i} + v_{j} – C_{ij}**.

- For
**C**,_{11}**P**_{11}= 0 + (-3) – 3 = -6 - For
**C**,_{13}**P**_{13}= 0 + 0 – 7 = -7 - For
**C**,_{14}**P**_{14}= 0 + (-1) – 4 = -5 - For
**C**,_{24}**P**_{24}= 5 + (-1) – 9 = -5 - For
**C**,_{31}**P**_{31}= 0 + (-3) – 8 = -11 - For
**C**,_{32}**P**_{32}= 3 + 1 – 3 = 1

There is one positive value i.e. 1 for **C _{32}**. Now this cell becomes new basic cell.

Now draw a loop starting from the new basic cell. Assign alternate plus and minus sign with new basic cell assigned as a plus sign.

Select the minimum value from allocated values to the cell with a minus sign. Subtract this value from the cell with a minus sign and add to the cell with a plus sign. Now the solution looks as shown in the image below:

Check if the total number of allocated cells is equal to (m + n – 1). Find u and v values as above.

Now again find the penalties for the unallocated cells as above.

- For
**P**_{11}= 0 + (-2) – 3 = -5 - For
**P**_{13}= 0 + 1 – 7 = -6 - For
**P**_{14}= 0 + 0 – 4 = -4 - For
**P**_{22}= 4 + 1 – 6 = -1 - For
**P**_{24}= 4 + 0 – 9 = -5 - For
**P**_{31}= 2 + (-2) – 8 = -8

All the penalty values are negative values. So the optimality is reached.

Now, find the total cost i.e. **(250 * 1) + (200 * 2) + (150 * 5) + (50 * 3) + (200 * 3) + (150 * 2) = 2450**