Skip to contents

Minimises sum c_ij x_ij subject to row sums = supply and column sums = demand by successive shortest augmenting paths (Bellman-Ford on the residual network); unbalanced problems get a zero-cost dummy source or sink.

Usage

TransportationProblem(cost, supply, demand)

Arguments

cost

Cost matrix (sources by sinks).

supply, demand

Non-negative amounts.

Value

list(flow, total_cost, balanced).

References

Hitchcock, F. L. (1941). The distribution of a product from several sources to numerous localities. Journal of Mathematics and Physics 20, 224-230.

Examples

TransportationProblem(rbind(c(4, 6), c(5, 3)), c(10, 10), c(8, 12))$total_cost
#> [1] 74