nag_transport (h03abc) solves the classical transportation (‘Hitchcock’) problem.
nag_transport (h03abc) solves the transportation problem by minimizing
subject to the constraints
where the
can be interpreted as quantities of goods sent from source
to destination
, for
and
, at a cost of
per unit, and it is assumed that
and
.
nag_transport (h03abc) uses the ‘stepping stone’ method, modified to accept degenerate cases.
- 1:
cost[] – const doubleInput
-
On entry: contains the coefficients , for and .
- 2:
tdcost – IntegerInput
-
On entry: the stride separating matrix column elements in the array
cost.
Constraint:
.
- 3:
avail[navail] – const doubleInput
-
On entry: must be set to the availabilities , for ;
- 4:
navail – IntegerInput
On entry: the number of sources, .
Constraint:
.
- 5:
req[nreq] – const doubleInput
-
On entry: must be set to the requirements , for .
- 6:
nreq – IntegerInput
On entry: the number of destinations, .
Constraint:
.
- 7:
maxit – IntegerInput
-
On entry: the maximum number of iterations allowed.
Constraint:
.
- 8:
numit – Integer *Output
-
On exit: the number of iterations performed.
- 9:
optq[] – doubleOutput
-
On exit: , for , contains the optimal quantities which, when sent from source to destination , minimize .
- 10:
source[] – IntegerOutput
-
On exit:
, for
, contains the source indices of the optimal solution (see
optq above).
- 11:
dest[] – IntegerOutput
-
On exit:
, for
, contains the destination indices of the optimal solution (see
optq above).
- 12:
optcost – double *Output
-
On exit: the value of the minimized total cost.
- 13:
unitcost[] – doubleOutput
-
On exit: , for , contains the unit cost associated with the route from source to destination .
- 14:
fail – NagError *Input/Output
-
The NAG error argument (see
Section 3.6 in the Essential Introduction).
The computations are stable.
Not applicable.
An a priori estimate of the run time for a particular problem is difficult to obtain.
A company has three warehouses and three stores. The warehouses have a surplus of 12 units of a given commodity divided between them as follows:
Warehouse |
Surplus |
1 |
1 |
2 |
5 |
3 |
6 |
The stores altogether need 12 units of commodity, with the following requirements:
Store |
Requirement |
1 |
4 |
2 |
4 |
3 |
4 |
Costs of shipping one unit of the commodity from warehouse
to store
are displayed in the following matrix:
|
|
Store |
|
|
1 |
2 |
3 |
|
1 |
8 |
8 |
11 |
Warehouse |
2 |
5 |
8 |
14 |
|
3 |
4 |
3 |
10 |
It is required to find the units of commodity to be moved from the warehouses to the stores, such that the transportation costs are minimized. The maximum number of iterations allowed is 200.
None.