Example (transport algorithm)

Let there be three suppliers with supplies $\v s=(14,10,9)$ and four consumers with demand $\v d = (12,5,8,8)$. The cost matrix is $$ \begin{align*} C = \pmat{5 & 3 & 4 & 6 \\ 2 & 7 & 4 & 1 \\ 5 & 6 & 2 & 4}. \end{align*} $$

... ... ... ...
... ... ... ... ... 14
... 5 ... 3 ... 4 ... 6
... ... ... ... ... 10
... 2 ... 7 ... 4 ... 1
... ... ... ... ... 9
... 5 ... 6 ... 2 ... 4
12 5 8 8

We find an initial basic feasible solution:

  1. We start with $x_{11}$. Set $x_{11}=12$ since this satisfies the demand $d_1=12$.

  2. Move to consumer 2. Set $x_{12} = 2$ since this satisfies the supply $s_1 = 14$.

  3. Move to supplier 2. Set $x_{22} = 3$ since this satisfies the demand $d_2 = 5$.

  4. Move to consumer 3. Set $x_{23} = 7$ since this satisfies the supply $s_2 = 10$.

  5. Move to supplier 3. Set $x_{33} = 1$ since this satsifies the demand $d_3 = 8$.

  6. Move to consumer 4. Set $x_{34} = 8$. This satisfies everyone.

... ... ... ...
... ... ... ... ... 14
12 5 2 3 0 4 0 6
... ... ... ... ... 10
0 2 3 7 7 4 0 1
... ... ... ... ... 9
0 5 0 6 1 2 8 4
12 5 8 8

To find the dual variables, we WLOG assume $\lambda_1=0$. Using complementary slackness, for $x_{ij}>0$, we require $c_{ij} = \lambda_i + \mu_j$. So we obtain the following equations: $$ \begin{align*} \begin{cases} \lambda_1 + \mu_1 = 5, \\ \lambda_1 + \mu_2 = 3, \\ \lambda_2 + \mu_2 = 7, \\ \lambda_2 + \mu_3 = 4, \\ \lambda_3 + \mu_3 = 2, \\ \lambda_3 + \mu_4 = 4 \end{cases} \implies \begin{cases} \lambda_1 = 0, \\ \lambda_2 = 4, \\ \lambda_3 = 2, \\ \mu_1 = 5, \\ \mu_2 = 3, \\ \mu_3 = 0, \\ \mu_4 = 2. \end{cases} \end{align*} $$

5 3 0 2
0 5 3 0 2 14
12 5 2 3 0 4 0 6
4 9 7 4 6 10
0 2 3 7 7 4 0 1
2 7 5 2 4 9
0 5 0 6 1 2 8 4
12 5 8 8

We now perform a solution update:

  1. We have $c_{21} = 2 < 9 = \lambda_2 + \mu_1$, so the solution is not optimal.

  2. Introducing the edge $(2,1)$ creates a cycle consisting supplier 2, consumer 1, supplier 1, and consumer 2.

  3. We can increase the flow $x_{21}$ to $\theta$ as long as all the adjusted flows are non-negative. In this case the maximum $\theta$ is $3$.

  4. Using complementary slackness, $$ \begin{align*} \begin{cases} \lambda_1 + \mu_1 = 5, \\ \lambda_1 + \mu_2 = 3, \\ \lambda_2 + \mu_1 = 2, \\ \lambda_2 + \mu_3 = 4, \\ \lambda_3 + \mu_3 = 2, \\ \lambda_3 + \mu_4 = 4 \end{cases} \implies \begin{cases} \lambda_1 = 0, \\ \lambda_2 = -3, \\ \lambda_3 = -5, \\ \mu_1 = 5, \\ \mu_2 = 3, \\ \mu_3 = 7, \\ \mu_4 = 9. \end{cases} \end{align*} $$

5 3 7 9
0 5 3 7 9 14
9 5 5 3 0 4 0 6
-3 2 0 4 6 10
3 2 0 7 7 4 0 1
-5 0 -2 2 4 9
0 5 0 6 1 2 8 4
12 5 8 8

Repeat the update:

  1. $1 = c_{24} < \lambda_2 + \mu_4 = 6$ so the solution is not optimal.

  2. We identify the cycle:

  3. Set $\theta=7$.

  4. Compute the dual variables.

5 3 2 4
0 5 3 2 4 14
9 5 5 3 0 4 0 6
-3 2 0 -1 1 10
3 2 0 7 0 4 7 1
0 5 3 2 4 9
0 5 0 6 8 2 1 4
12 5 8 8

  1. Now all $c_{ij} \geq \lambda_i + \mu_j$. Hence this is the optimal solution.