Transportation and Assignment Problems as Min-Cost Flow

Formulates the classical transportation problem and the assignment problem as instances of min-cost flow on a bipartite network with a source and sink, and solves small instances by computing total cost or enumerating assignments.

Step 1 of 157%

Tutorial

The Transportation Problem as Min-Cost Flow

The transportation problem asks how to ship a single commodity from mm supply nodes to nn demand nodes at minimum total cost. Supplier ii has sis_i units available, customer jj requires djd_j units, and shipping one unit from ii to jj costs cijc_{ij}.

We model this as a min-cost flow problem on a bipartite network with an added source SS and sink TT. The arcs are:

  1. (S,i)(S, i) with capacity sis_i and cost 00, for each supplier ii.
  2. (i,j)(i, j) with capacity \infty and cost cijc_{ij}, for each supplier-customer pair.
  3. (j,T)(j, T) with capacity djd_j and cost 00, for each customer jj.

Assuming the problem is balanced, meaning

i=1msi=j=1ndj,\sum_{i=1}^m s_i = \sum_{j=1}^n d_j,

the optimal shipment is a min-cost flow from SS to TT of value

F=i=1msi.F = \sum_{i=1}^m s_i.

The total arc count is m+mn+nm + mn + n. For example, with m=2m = 2 suppliers and n=2n = 2 customers, the network has 2+4+2=82 + 4 + 2 = 8 arcs.

navigate · Enter open · Esc close · ⌘K/Ctrl K toggle