This file shows how to solve the minimum cost flow problem for the "Distribution Unlimited Co." prototype example from Hillier and Lieberman, Sections 3.4/9.6.

We have a distribution network with five nodes, two of which are sources (factories F1 and F2), one is a transshipment node (distribution center DC), and two are sinks (warehouses W1 and W2). The inflow/outflow at each node is given by $b_i$, the $C_{ij}$ denote the unit cost of transportation from node $i$ to node $j$ and the $U_{ij}$ are upper bounds on the capacity on some of the arcs.

The decision variables are the $x_{ij}$, the flow on the arc $(i,j)$.

The first set of constraints reflects the requirement that inflow plus sources equals outflow at each node.

The second set of constraints implements the capacity restrictions on the arcs.

The objective is to minimize the total cost of transportation.

Now we can solve and inspect the results:

Not ethe integer solution property: All $x_{ij}$ are integer. Even more, since all $b_i$ and $u_{ij}$ came in units of $10$, all $x_{ij}$ come in units of $10$ as well.

Let us also look at the shadow prices:

So, for example: Suppose we could increase the supply by one unit in either F1 or F2, and the demand in either W1 or W2. Which combination should we choose to increase the cost the least? Increasing the b by one unit at either F1 or F2 will lead to an increase of 700 or 600. Increasing the demand at W1 or W2 means adding -1 to the respective b's. So this comes at a price of $(-1)*(-200) = 200$ for W1 and 0 for W2 (Careful here: We decrease the b, so we need to multiply the shadow prices by -1.)

Conclusion: We should choose F2 and W2, because this would increase the transportation costs the least, namely by 600.

This means: Increasing the capacity limit for arc (F1,F2) will not reduce the cost at all. But increasing the capacity limit at arc (DC,W2) would reduce the cost.