Skip to content

Strategic Cost Management · Transportation

MODI Method for Transportation Problem: Optimality Test

Updated 11 October 2026 · Fact-checked

The MODI (u-v) method tests whether a basic feasible solution to a transportation problem is optimal. You find u and v values from the allocated cells, compute the opportunity cost of every empty cell, and check the signs. If any is negative in a minimisation problem, you reallocate along a loop and repeat.

Understand Optimality Test using MODI Method

A transportation problem first gives you a starting plan, called an initial basic feasible solution (IBFS). It uses methods such as North-West Corner, Least Cost or VAM. That plan satisfies supply and demand, but it may not be the cheapest. The MODI method checks whether it is, and shows how to improve it if it is not.

The idea is simple. Give every source a number u and every destination a number v. For each allocated cell, set u + v equal to its unit cost. These numbers act like implied prices at each point. For an empty cell, u + v is the cost the current plan already 'implies' for that route. If the actual cost is higher than that, using the route does not help. If the actual cost is lower, the route is a bargain and the plan can be improved.

That gap is the opportunity cost (also called the cell evaluation or net evaluation): d = c − (u + v). In a minimisation problem, a negative d means each unit moved to that cell reduces total cost by that amount. You choose the cell with the most negative d, trace a closed loop of allocated cells, and shift the largest possible quantity around it. Then you recompute u, v and d.

You stop when no empty cell has a negative d (minimisation). A zero d on an empty cell means an alternate optimal solution exists with the same total cost.

The stepping stone method uses the same logic but finds each empty cell's effect by tracing a loop for every cell. MODI gets all the effects from u and v without tracing loops. You trace a loop only for the one cell that enters. This is why MODI is faster in exams.

Key rules to remember

Basic feasible solution requirement
Number of allocated cells = m + n − 1
m = sources, n = destinations. Check this before you start. If fewer cells are allocated, the solution is degenerate and u-v values cannot be found until you add a zero allocation in a suitable cell.
u-v equation for allocated cells
uᵢ + vⱼ = cᵢⱼ
Applies only to allocated cells. Set one u (usually the row with the most allocations) to 0 and solve the rest.
Opportunity cost of an empty cell
dᵢⱼ = cᵢⱼ − (uᵢ + vⱼ)
Computed for empty cells only.
Optimality condition (minimisation)
All dᵢⱼ ≥ 0
If any dᵢⱼ < 0, the solution can be improved. Enter the cell with the most negative d. If any empty cell has d = 0 and the rest are positive, an alternate optimum exists.
Optimality condition (maximisation, with c as profit)
All dᵢⱼ ≤ 0, where dᵢⱼ = cᵢⱼ − (uᵢ + vⱼ)
The rule reverses. Alternatively, convert profit to loss by subtracting every profit from the largest profit and then use the minimisation rule.
Reallocation quantity
θ = smallest allocation among the cells marked '−' in the loop
Add θ to '+' cells and subtract it from '−' cells. The cell that falls to zero leaves the solution.
Change in total cost
Change in cost = dᵢⱼ × θ
Use this to check each iteration. With a negative d, the cost falls by |d| × θ.

How to solve Optimality Test using MODI Method questions

Use this method for any MODI question where the initial solution is given or must be found first.

  1. 1Check that the problem is balanced (total supply = total demand). If not, add a dummy row or column with zero cost. Then count the allocated cells and confirm there are m + n − 1. If there are fewer, add a zero allocation to an independent cell.
  2. 2Write the u-v equations for all allocated cells. Set u = 0 for the row with the most allocations and solve for all other u and v values.
  3. 3Calculate d = c − (u + v) for every empty cell. Write each d in the corner of its cell.
  4. 4Test for optimality. For minimisation, if all d ≥ 0 the solution is optimal, so go to step 7. Otherwise pick the empty cell with the most negative d.
  5. 5Draw a closed loop starting at that cell. Use only horizontal and vertical moves, and turn only at allocated cells. Mark the entering cell '+', then alternate '−' and '+' around the loop.
  6. 6Find θ, the smallest allocation among the '−' cells. Add it to '+' cells and subtract it from '−' cells. Remove the cell that becomes zero. Make sure the allocated cells still number m + n − 1. Go back to step 2.
  7. 7When the solution is optimal, write the allocation table and compute total cost as Σ (units × unit cost). Mention any zero d on an empty cell as an alternate optimum.

Quickest way: Fast MODI check with d-values and cost-change verification

When to use it: Use this under time pressure when the IBFS is already given and the question asks for the optimal cost.

  1. Start u = 0 on the row with the most allocations. Fill v values across, then the remaining u values, in one sweep.
  2. Calculate d only for empty cells. A 3 × 3 problem has just four of them.
  3. Scan for negatives. If there are none, stop and report the cost you already have.
  4. For the entering cell, trace the loop and find θ. Compute the new cost as old cost + d × θ.
  5. Confirm by multiplying out the allocations. If the two figures differ, recheck the loop signs or the u-v values.

Common mistakes in Optimality Test using MODI Method

  • Starting MODI with fewer or more than m + n − 1 allocated cells.

    Students copy the IBFS without counting, or a degenerate IBFS has a missing allocation.

    Fix: Always count allocated cells first. Add a zero allocation in an independent empty cell if the count is short. 'Independent' means it does not close a loop with the allocated cells.

  • Calculating d for allocated cells, or using u + v − c instead of c − (u + v).

    Students mix up the sign convention, or apply the u-v equation to every cell.

    Fix: Allocated cells satisfy u + v = c, so their d is always 0. Compute d = c − (u + v) only for empty cells. Keep one sign convention throughout.

  • Drawing a loop that cuts across an empty cell or turns at an empty cell.

    Students take a shortcut across the table instead of following allocated cells.

    Fix: The loop turns only at allocated cells, apart from the entering cell. Every row and column in the loop has exactly two cells in it.

  • Taking θ from the '+' cells, or from all loop cells.

    Students forget that only '−' cells can run out of units.

    Fix: Take the smallest allocation among '−' cells only. Subtract θ from them and add it to '+' cells.

  • Declaring the solution optimal when d is zero somewhere, or ignoring the alternate optimum.

    Zero is read as a problem rather than a signal.

    Fix: All d ≥ 0 means optimal. A zero d on an empty cell means another optimal plan with the same cost exists. Mention it if the question asks for it.

  • Applying the minimisation rule to a profit-maximisation problem.

    Students are on autopilot after practising cost problems.

    Fix: Read whether the matrix shows cost or profit. For profit, optimal means all d ≤ 0, or convert the matrix to opportunity loss first.

Worked examples

Example 1

A company supplies goods from three plants S1, S2 and S3 (capacity 50, 40 and 60 units) to three depots D1, D2 and D3 (requirement 30, 50 and 70 units). Unit transport costs (₹) are: S1: 4, 6, 8; S2: 5, 3, 7; S3: 6, 5, 4. The initial solution by North-West Corner method is: S1D1 = 30, S1D2 = 20, S2D2 = 30, S2D3 = 10, S3D3 = 60. Test it for optimality using MODI and find the optimal plan and its cost.

Show the solution
  1. Count allocations: 5 = 3 + 3 − 1, so the solution is non-degenerate. Initial cost = 30×4 + 20×6 + 30×3 + 10×7 + 60×4 = 120 + 120 + 90 + 70 + 240 = ₹640.
  2. Set u1 = 0. S1D1: v1 = 4. S1D2: v2 = 6. S2D2: u2 = 3 − 6 = −3. S2D3: v3 = 7 − (−3) = 10. S3D3: u3 = 4 − 10 = −6.
  3. Opportunity costs of empty cells: S1D3 = 8 − (0 + 10) = −2. S2D1 = 5 − (−3 + 4) = 4. S3D1 = 6 − (−6 + 4) = 8. S3D2 = 5 − (−6 + 6) = 5.
  4. S1D3 is negative (−2), so the solution is not optimal. Loop: S1D3 (+), S2D3 (−), S2D2 (+), S1D2 (−).
  5. θ = smaller of S2D3 = 10 and S1D2 = 20, so θ = 10. New allocations: S1D3 = 10, S2D3 = 0 (leaves), S2D2 = 40, S1D2 = 10. Table: S1D1 = 30, S1D2 = 10, S1D3 = 10, S2D2 = 40, S3D3 = 60. Cost = 120 + 60 + 80 + 120 + 240 = ₹620, which equals 640 − 2 × 10.
  6. Recompute u-v: u1 = 0, v1 = 4, v2 = 6, v3 = 8. S2D2: u2 = 3 − 6 = −3. S3D3: u3 = 4 − 8 = −4.
  7. Opportunity costs: S2D1 = 5 − (−3 + 4) = 4. S2D3 = 7 − (−3 + 8) = 2. S3D1 = 6 − (−4 + 4) = 6. S3D2 = 5 − (−4 + 6) = 3. All are positive, so the solution is optimal and unique.

Answer: Optimal plan: S1 sends 30 to D1, 10 to D2 and 10 to D3; S2 sends 40 to D2; S3 sends 60 to D3. Minimum transportation cost = ₹620.

Example 2

Two warehouses A and B (supply 70 and 50 units) serve three shops X, Y and Z (demand 40, 30 and 50 units). Unit costs (₹): A: X 6, Y 8, Z 4; B: X 5, Y 7, Z 9. An initial solution is A→Y 30, A→Z 40, B→X 40, B→Z 10. Use MODI to find the optimal cost and say whether the optimal plan is unique.

Show the solution
  1. Allocated cells = 4 = 2 + 3 − 1. Initial cost = 30×8 + 40×4 + 40×5 + 10×9 = 240 + 160 + 200 + 90 = ₹690.
  2. Set uA = 0. AY: vY = 8. AZ: vZ = 4. BZ: uB = 9 − 4 = 5. BX: vX = 5 − 5 = 0.
  3. Empty cells: AX = 6 − (0 + 0) = 6. BY = 7 − (5 + 8) = −6. BY is negative, so the plan is not optimal.
  4. Loop for BY: BY (+), AY (−), AZ (+), BZ (−). θ = smaller of AY = 30 and BZ = 10, so θ = 10.
  5. New allocations: BY = 10, AY = 20, AZ = 50, BZ = 0, BX = 40. Cost = 20×8 + 50×4 + 40×5 + 10×7 = 160 + 200 + 200 + 70 = ₹630, which equals 690 − 6 × 10.
  6. Recompute: uA = 0, vY = 8, vZ = 4. BY: uB = 7 − 8 = −1. BX: vX = 5 − (−1) = 6.
  7. Empty cells: AX = 6 − (0 + 6) = 0. BZ = 9 − (−1 + 4) = 6. No d is negative, so the plan is optimal. The zero at AX shows an alternate optimum.
  8. Check the alternate: enter AX with loop AX (+), AY (−), BY (+), BX (−). θ = min(20, 40) = 20. New plan: AX = 20, AZ = 50, BX = 20, BY = 30. Cost = 120 + 200 + 100 + 210 = ₹630, the same.

Answer: Minimum cost = ₹630. The optimal plan is not unique, because the empty cell AX has opportunity cost zero. One optimal plan is A→Y 20, A→Z 50, B→X 40, B→Y 10. Another is A→X 20, A→Z 50, B→X 20, B→Y 30.

Exam tips

  • MCQs often give you the u-v values or one opportunity cost and ask for the next step or the cost after reallocation. Use cost change = d × θ rather than rebuilding the whole table.
  • In written answers, show the u-v equations, the d-table and the loop with signs. Marks go for each stage, so do not skip to the final table.
  • Check the count of m + n − 1 first. Many questions give a degenerate IBFS on purpose and expect you to add a zero allocation.
  • Read whether the matrix is cost or profit. For profit, optimal means all d ≤ 0 with d = c − (u + v). Say which rule you used.
  • State the final plan and total cost clearly. If an empty cell has d = 0, say that an alternate optimal solution exists.

Practice questions from Transportation

Optimality Test using MODI Method in other exams

The same ground in other exams, if you are preparing for more than one or want another angle on it.

Optimality Test using MODI Method: frequently asked questions

What is the difference between the stepping stone method and the MODI method?

Both test an initial solution for optimality and reach the same answer. Stepping stone traces a closed loop for every empty cell to find its cost effect. MODI calculates all the effects from u and v values and needs a loop only for the cell that enters. MODI is therefore much quicker for larger tables.

How do I find u and v values in the MODI method?

Set u to 0 for the row with the most allocated cells. Then use u + v = c for every allocated cell to find the other values. You move across rows and columns until every u and v is found. Use only allocated cells for this step.

How do I know the transportation solution is optimal?

Calculate d = c − (u + v) for every empty cell. In a minimisation problem, the solution is optimal when no d is negative. If an empty cell has d = 0, the solution is still optimal, but another plan with the same cost exists.

What if the initial solution has fewer than m + n − 1 allocations?

The solution is degenerate and you cannot find all u and v values. Add a very small allocation (shown as zero) in an empty cell that does not form a closed loop with the allocated cells. Then continue with the normal MODI steps.