Transportation Problem Calculator
Free transportation problem calculator: enter a cost table with supply and demand, get the initial solution by VAM, Least Cost or North-West Corner, and the optimal plan by the MODI method, step by step.
Transportation Problem Calculator
Enter the cost of shipping one unit from each source (S) to each destination (D), plus supply and demand. The calculator finds an initial solution and improves it with the MODI method until it is optimal.
Or solve it as a linear program (simplex method)
How Simplex Method Calculator Works
Enter the LP Problem
Type the objective function coefficients and every constraint row with its right-hand-side value.
Choose Maximize or Minimize
Pick your optimization goal. The tool builds the initial tableau with slack variables automatically.
Run the Pivot Iterations
The calculator identifies pivot column by Cj-Zj, computes ratios, performs elementary row operations until optimal.
Read the Optimal Solution
Final tableau displays optimal variable values, Zj row, and the maximum/minimum objective value.
Sample Simplex Tableau Output
Example tableau iteration for a 2-variable maximization problem
| Basis | x1 | x2 | s1 | s2 | RHS | Cj-Zj |
|---|---|---|---|---|---|---|
| x1 | 14 | 0 | 0 | 1 | 14 | 0 |
| x2 | 7 | 1 | 0 | 0 | 7 | 5 |
| Zj | 35 | 5 | 0 | 0 | 35 |
How to Use the Transportation Problem Calculator
Set the number of sources (rows) and destinations (columns), click Update table, and type the cost of shipping one unit on each route. Enter the supply of every source in the last column and the demand of every destination in the bottom row. Choose how to build the starting plan (Vogel's Approximation Method, the Least Cost Method or the North-West Corner rule) and click Solve. Use Load example to see a complete 3 x 4 problem.
What the Calculator Shows
First it checks whether total supply equals total demand. If not, it adds a dummy source or destination with zero costs so the problem is balanced. Next it builds the initial basic feasible solution with the method you chose; for VAM it lists the row and column penalties at every step and explains which cell receives each allocation. Then it applies the MODI (u-v) method: it computes u and v from the occupied cells, the opportunity cost d of every empty cell, marks the improvement loop with plus and minus signs, and shows the amount theta that is shifted. It repeats until every d is zero or positive, and reports the optimal shipping plan with the minimum total cost written out term by term.
Degenerate Problems
A basic solution of an m x n transportation problem needs m + n - 1 occupied cells. When an allocation meets a row total and a column total at the same time, fewer cells are occupied. The calculator detects this and places a zero allocation in a suitable cell so that the MODI method can still compute u and v, and tells you which cell was used.
Worked Example
For the built-in example (3 sources, 4 destinations, total supply and demand 34), the North-West Corner rule starts at a cost of 1,015, the Least Cost Method at 814 and VAM at 779. Starting from VAM, a single MODI improvement on the route S2 to D2 lowers the cost by 36 to the optimum of 743. Every step of this example is explained by hand in our guide to the transportation problem.
Solving It as a Linear Program
A transportation problem is also a linear program with one variable per route, one equality constraint per source and one per destination. If you prefer that form, use the simplex calculator further down this page: it solves the same problem with the simplex method and shows every tableau. For a 3 x 4 problem that means 12 variables, so the table method above is usually faster.
Related calculators
Frequently Asked Questions
What is the transportation problem?
It is a linear programming problem that finds the cheapest way to ship goods from several sources to several destinations so that every supply limit and every demand requirement is met.
Which method gives the best initial solution?
Vogel's Approximation Method usually starts closest to the optimum because it uses penalties, the difference between the two cheapest routes in each row and column. The North-West Corner rule ignores costs and usually starts highest. In the built-in example the starting costs are 779 (VAM), 814 (Least Cost) and 1,015 (North-West Corner).
How does the MODI method work?
MODI assigns a number u to each row and v to each column so that u + v equals the cost of every occupied cell. For each empty cell it computes d = cost - (u + v). If any d is negative, shipping on that route would lower the total cost, so the plan is improved along a closed loop. When all d are zero or positive, the plan is optimal.
What if supply and demand are not equal?
The problem is unbalanced. The calculator adds a dummy row (if demand is larger) or a dummy column (if supply is larger) with zero costs to absorb the difference, then solves the balanced problem.
Does the calculator show every step?
Yes. It shows each allocation of the initial method (including VAM penalties), every MODI table with u, v and d values, the improvement loop and theta, and the final optimal plan with the total cost calculation.