Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 29

Optimizing Photoshoot Timelines with MODI

Recommended resources

Welcome back. In our last lesson, we developed two initial allocation plans for our boudoir photoshoot using the North-West Corner Rule and Vogel's Approximation Method. We saw that VAM gave us a much "cheaper" plan in terms of our "regret cost" metric. However, an initial feasible solution, even a good one, is not guaranteed to be the optimal solution.

Today, we will address the learning outcome: Use the Modified Distribution (MODI) Method to test and improve a photoshoot time allocation plan for optimality. We will take an initial solution and rigorously test it. If it's not optimal, we will use the MODI method to systematically improve it until no further cost reduction is possible. This powerful technique will ensure our final photoshoot plan maximizes "sexiness" by minimizing our regret cost.

The Theory Behind MODI: Duality and Opportunity Costs

Before diving into the mechanics, it's useful to understand what MODI accomplishes. Given your background in Operations Research, you'll recognize that the transportation problem is a special type of linear program. The MODI method is an efficient, specialized algorithm for solving this LP. It works by calculating the dual variables (also called shadow prices or potentials) associated with the supply and demand constraints.

[PDF] A Unified Mathematical Framework for NWC, MODI, and Stepping ...

This paper provides an advanced perspective, framing classical OR methods within modern Optimal Transport theory. It's not necessary to absorb all the details, but the key insight for our lesson is how it elevates MODI from a mere heuristic to a rigorous dual optimization algorithm.

Read the Abstract to grasp the paper's goal. Then, focus on three key passages: The statement that MODI computes dual potentials. The explanation that MODI's reduced-cost calculations are exact dual variables. The confirmation that the method's "u–v potentials" correspond to Kantorovich dual potentials. This establishes that the u_i and v_j values we will soon calculate are not arbitrary numbers but have a deep theoretical meaning as dual variables.

In essence, MODI evaluates the "opportunity cost" for each empty cell in our allocation table. It asks: "For every unit of time we could shift into this currently unused outfit-pose combination, what would be the net change in total cost?" If this change is negative (i.e., a cost saving), our current solution is not optimal, and MODI shows us exactly how to improve it.


Step 1: Start with an Initial Basic Feasible Solution (IBFS)

To demonstrate the improvement process, we will start with the initial solution generated by the North-West Corner (NWC) rule from our previous lesson. While we know the VAM solution was better, the NWC solution is more likely to be sub-optimal, giving us a clear path for improvement.

Here is our starting point:

  • Cost Matrix (Regret Cost):
    | | Combo A | Combo B | Combo C | Combo D |
    | :--- | :---: | :---: | :---: | :---: |
    | Morning | 1 | 3 | 4 | 6 |
    | Afternoon| 2 | 0 | 5 | 2 |

  • NWC Allocation Plan & Total Cost:
    | | Combo A | Combo B | Combo C | Combo D | Supply |
    | :--- | :---: | :---: | :---: | :---: | :---: |
    | Morning | 80 | 40 | | | 120 |
    | Afternoon| | 60 | 50| 70| 180 |
    | Demand | 80 | 100| 50 | 70 | 300 |

The initial total regret cost is 590. Before we begin, we check for non-degeneracy: the number of allocated cells must equal , where is the number of rows and is the number of columns. Here, we have 5 allocated cells, and . The condition holds.


Step 2: The MODI (UV) Method - Iteration 1

The MODI method follows a clear, iterative process. A great way to learn it is to see it in action.

Transportation problem [ MODI method - U V method with Optimal Solution ] kauserwise

This video provides a very clear, step-by-step walkthrough of a full MODI problem. We will follow this same logic for our photoshoot scenario.

Watch the core mechanics of the first iteration from application of UV method. Pay close attention to these three sub-steps: Calculating the U and V values for allocated cells. Calculating the penalties (opportunity costs) for non-allocated cells. Identifying the cell with the best improvement potential and drawing the closed loop.

Let's apply this process to our photoshoot problem.

A. Calculate Dual Potentials ()

We introduce a potential for each row and for each column. For every occupied cell, they must satisfy the equation: .

  1. By convention, we set (for the Morning row).
  2. Cell (M, A) is occupied, with . So, .
  3. Cell (M, B) is occupied, with . So, .
  4. Cell (A, B) is occupied, with . So, .
  5. Cell (A, C) is occupied, with . So, .
  6. Cell (A, D) is occupied, with . So, .

Our calculated potentials are: and .

B. Calculate Opportunity Costs for Empty Cells

Now, for each empty cell, we calculate the opportunity cost, or improvement index (), using the formula: . A positive value indicates a potential cost saving.

  • Cell (M, C): .
  • Cell (M, D): .
  • Cell (A, A): .
  • Cell (C, C): This cell is not in our problem. Apologies for any confusion in the prior step's summary. Let's re-verify the empty cells: (M,C), (M,D), (A,A), (M,C) is a typo. Let's recheck the empty cells: (M,C), (M,D), (A,A) and (M,B) is occupied, (A,B) is occupied. Hmm, let me check the matrix again. Ah, NWC solution was (M,A), (M,B), (A,B), (A,C), (A,D). The empty cells are (M,C), (M,D), (A,A) and (M,A) is occupied. Oh, I see my mistake. The empty cells are (M,C), (M,D), (A,A) and... wait, a 2x4 matrix should have 8 cells. 5 are occupied. So 3 are empty. (M,C), (M,D), (A,A). My calculation list was off.
    Let's recalculate for the correct 3 empty cells.
  • Cell (M, C): .
  • Cell (M, D): .
  • Cell (A, A): .

The optimality condition states that if all , the solution is optimal. We have a positive value (), so our solution is not optimal. We can improve it by shifting time allocation into the (Morning, Combo C) cell.

C. Form a Closed Loop to Improve the Solution

We select the empty cell with the most positive , which is (M, C). This is our "entering cell."

  1. Draw the Loop: Starting from the entering cell (M, C), we trace a closed path of horizontal and vertical lines, where every corner of the path is an occupied cell.

    • Start at (M, C) and place a +.
    • Move horizontally to (M, B), place a -.
    • Move vertically to (A, B), place a +.
    • Move horizontally to (A, C), place a -.
    • Move vertically back to (M, C) to close the loop.

    Our loop is: (M, C) (M, B) (A, B) (A, C) (M, C).

  2. Reallocate: Look at the cells in the loop with a - sign: (M, B) has 40 minutes, and (A, C) has 50 minutes. We find the minimum of these values, which is 40.

    • Subtract 40 from the quantities in the - cells.
    • Add 40 to the quantities in the + cells.

    The new allocations become:

    • (M, C):
    • (M, B): (This cell becomes empty)
    • (A, B):
    • (A, C):

Our new allocation table (Iteration 2) is:

Combo A Combo B Combo C Combo D Supply
Morning 80 40 120
Afternoon 100 10 70 180
Demand 80 100 50 70 300

The new total cost is .
Our cost has dropped from 590 to 430, a significant improvement!


Step 3: Test for Optimality - Iteration 2

Is the solution optimal now? We must repeat the process.

How to Find the Optimal Solution to a Transportation Problem Using the MODI Method

This video also demonstrates the iterative nature of MODI.

Watch how the presenter, after making the first adjustment, immediately begins to recalculate the U and V values for the new table. Then, see how they re-evaluate the unallocated cells. Finally, observe what happens when they find no remaining negative values (in their convention), signifying optimality.

A. Recalculate Potentials for the New Table

Our occupied cells are now (M, A), (M, C), (A, B), (A, C), (A, D).

  1. Set .
  2. (M, A), : .
  3. (M, C), : .
  4. (A, C), : .
  5. (A, B), : .
  6. (A, D), : .

Potentials: and .

B. Recalculate Opportunity Costs for New Empty Cells

The new empty cells are (M, B), (M, D), (A, A).

  • Cell (M, B): .
  • Cell (M, D): .
  • Cell (A, A): .

All opportunity costs () are now zero or negative. This satisfies the optimality condition. There are no empty cells that would provide a cost reduction if we were to allocate time to them.

This image illustrates the core logic of the MODI method. It shows the identification of empty cells, the formation of a closed loop for one of them (BD), and the calculation of the Net Cost Change (or opportunity cost) for each empty cell to test for optimality.

Conclusion

We have successfully tested and improved our photoshoot time allocation plan. The final plan, with a total regret cost of 430, is now proven to be optimal.

Key Takeaways:

  • MODI as an Optimality Test: The MODI method provides a definitive test to determine if an initial feasible solution from methods like NWC or VAM is optimal.
  • The Role of Dual Potentials: The and values are dual variables that allow us to calculate the opportunity cost () for each unallocated cell.
  • Iterative Improvement: If any opportunity cost is positive, the solution is not optimal. MODI provides a systematic way to improve the solution by identifying an entering cell, forming a closed loop, and reallocating resources.
  • Stopping Condition: The algorithm terminates when all opportunity costs () are less than or equal to zero, guaranteeing that the current solution is the true optimum.

Interestingly, the optimal solution we reached by improving the NWC result is the exact same solution we found directly using Vogel's Approximation Method in the last lesson. This beautifully illustrates why VAM is such a powerful heuristic: it often gets you very close to, or even directly to, the optimal solution, saving significant work in the optimization phase.

In our next lesson, we will shift our focus to a different type of allocation problem. We will apply the Hungarian Method to optimally assign specific outfits to photoshoot time slots to maximize the total 'sexiness' score, tackling a pure assignment problem.