Home / Science / Maths, statistics and computing / Operations research / Transportation and assignment problem solverTool #583

Transportation problem solver (northwest corner, least cost, Vogel, MODI) and Hungarian assignment solver, step by step

Solve a transportation problem from a starting plan (northwest corner, least cost or Vogel's approximation) to the optimum with the MODI method, showing every step, the u and v potentials and dummy rows for unbalanced problems. Or solve an assignment problem with the Hungarian method, minimising cost or maximising profit. Checked against scipy.

Keep it one tap away for everyday use.

Bookmark Transportation and assignment problem solver?

Press Ctrl + D now. Your browser opens its own bookmark box, where you choose the name and folder.

  1. Costs
  2. Start plan
  3. Improve
  4. Optimum
Nothing is uploadedWorks offline once open

Problem

Paste from a spreadsheet, or separate values with tabs, commas or spaces. Names in the first row and column are optional. Write x for a route that is not allowed. If supply and demand totals differ, a dummy source or destination takes up the difference at zero cost. Up to 20 sources and 20 destinations.

What it does

Two classic problems from an operations research course, solved in your browser with the working shown:

  • Transportation problem: several sources (factories, depots) with a supply, several destinations (shops, warehouses) with a demand, and a cost per unit on each route. Which routes should carry how much, to meet demand at the lowest total cost? The tool builds a starting plan by the northwest corner rule, the least-cost method or Vogel’s approximation method, then improves it with the MODI (u-v) method, moving goods round stepping-stone loops until no route can lower the cost.
  • Assignment problem: give each person (or machine) a different job so the total cost or time is lowest, or the total profit highest. Solved by the Hungarian method.

How to use it

  1. Choose Transportation or Assignment, and the goal: lowest total cost, or highest total profit.
  2. For transportation, paste the cost table with each source’s supply in the last column and each destination’s demand in the last row (names in the first row and column are optional). Paste straight from a spreadsheet or open a CSV, TSV or Excel file.
  3. Write x for a route or pairing that is not allowed.
  4. Pick the starting plan method. All three reach the same optimum; Vogel usually starts closest to it, northwest corner furthest.
  5. Read the answer, the best plan, the improvement steps and the starting plan. Download the plan as CSV, or the whole working as an image, PDF or Word file.

What the results mean

  • Shaded cells carry goods; the small number under each is the cost per unit.
  • u and v are the MODI potentials. On every used route cost = u + v; on every unused route cost − u − v is 0 or more. That is the proof that no cheaper plan exists.
  • Each improvement step adds the unused route whose cost − u − v is most negative, moves θ units round a loop of used routes, and drops a route that falls to zero.
  • Unbalanced problems get a dummy destination (spare supply) or dummy source (unmet demand) at zero cost.
  • Degenerate plans have fewer than rows + columns − 1 used routes; a 0 is kept in a cell so the method can carry on.
  • Other equally good plans says yes when an unused route has cost − u − v exactly 0.

Worked example

The example has three factories (supplies 40, 55, 45) and four warehouses (demands 30, 35, 40, 35). The northwest corner rule starts at a cost of 2145, least cost at 1820 and Vogel at 1780. MODI takes two steps from the northwest corner, one from least cost and none from Vogel, and all three end at the lowest total cost of 1780: F1 sends 5 to W1 and 35 to W4, F2 sends 35 to W2 and 20 to W3, F3 sends 25 to W1 and 20 to W3. scipy’s linear programming solver gives the same 1780.

The assignment example gives four people four jobs, with the minutes each would take. The lowest total is 38 minutes: Asha → Job 3, Ben → Job 2, Chen → Job 1, Dara → Job 4. Choose “highest total” and the largest total is 82.

Limits

Transportation tables up to 20 × 20 and assignment tables up to 50 × 50. It solves the classic forms only: no transhipment through middle points, no fixed costs per route and no integer-only rules beyond what the methods give (with whole-number supplies and demands the answer is in whole numbers anyway).

Frequently asked questions

Why does my answer differ from my textbook’s plan? If “Other equally good plans” says yes, several plans share the lowest cost. Starting plans can also differ when ties are broken another way; the optimal total is the same.

Is my data stored? No. Everything runs in your browser and nothing is stored or sent anywhere.

Where the numbers come from

  • Standard operations-research methods (northwest corner rule, least-cost method, Vogel's approximation, MODI / u-v method with stepping-stone loops, Hungarian method of Kuhn and Munkres), written by fibub.
  • Checked against scipy (BSD licence): optimize.linprog (HiGHS) for 150 random transportation problems and optimize.linear_sum_assignment for 150 random assignment tables, including unbalanced, degenerate, forbidden and maximising cases; all optima equal.
  • The factory and job examples are made up for this tool.

Standard scientific values, such as constants, atomic weights and melting points, are facts found in every textbook; we name where ours were checked. If you are an author or publisher and want a value, a credit or a table changed or removed, tell us and we will act quickly.

Last updated 2026-11-09.

Related tools

CSV profiler and SQL playground #38 Open CSV, TSV or Excel files and get a profile of every column: type, missing values, distinct values, range and most common values. Then query them with SQL (SQLite), join files, and download the result. Nothing is uploaded. Graph editor with algorithms #556 Draw a graph or paste an edge list (weighted, directed or not) and run Dijkstra, Bellman-Ford, breadth- and depth-first search, Kruskal and Prim spanning trees, maximum flow with the minimum cut, greedy and DSatur colouring, degree, betweenness and closeness centrality, or a topological order. Results are highlighted on the drawing. Checked against networkx. Linear and integer programming solver #582 Type a linear or integer program as plain text (maximize or minimize, constraints, bounds, whole-number and yes/no variables) and get the optimal solution, shadow prices, reduced costs, the simplex tableaux step by step, and a picture for two variables. Runs in your browser. Vehicle routing for small instances #586 Plan delivery routes from one depot: give the customers as map coordinates or a distance table, their demands, the vehicle capacity and the number of vehicles. Clarke-Wright savings with 2-opt and or-opt improvement, the exact shortest plan for up to 12 customers, a route map and a stop-by-stop table. Checked against brute force and an integer program. Queueing calculator #584 Average waits, queue lengths, utilisation and the chance of waiting for the standard queue models, how many servers or agents you need for a target wait, and a discrete-event simulation that checks the formulas. Runs in your browser. Project scheduling: CPM, PERT and Gantt #585 List your tasks, durations and predecessors (finish-to-start, start-to-start, finish-to-finish, with lags) and get the critical path, earliest and latest dates, float, a Gantt chart, and with three-point estimates the PERT chance of finishing by a date, checked by simulation. Runs in your browser.