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
.
- 1:
– const doubleInput
-
On entry: contains the coefficients , for and .
- 2:
– IntegerInput
-
On entry: the stride separating matrix column elements in the array
cost.
Constraint:
.
- 3:
– const doubleInput
-
On entry: must be set to the availabilities , for ;
- 4:
– IntegerInput
-
On entry: the number of sources, .
Constraint:
.
- 5:
– const doubleInput
-
On entry: must be set to the requirements , for .
- 6:
– IntegerInput
-
On entry: the number of destinations, .
Constraint:
.
- 7:
– IntegerInput
-
On entry: the maximum number of iterations allowed.
Constraint:
.
- 8:
– Integer *Output
-
On exit: the number of iterations performed.
- 9:
– doubleOutput
-
On exit: , for , contains the optimal quantities which, when sent from source to destination , minimize .
- 10:
– IntegerOutput
-
On exit:
, for
, contains the source indices of the optimal solution (see
optq above).
- 11:
– IntegerOutput
-
On exit:
, for
, contains the destination indices of the optimal solution (see
optq above).
- 12:
– double *Output
-
On exit: the value of the minimized total cost.
- 13:
– doubleOutput
-
On exit: , for , contains the unit cost associated with the route from source to destination .
- 14:
– NagError *Input/Output
-
The NAG error argument (see
Section 3.7 in How to Use the NAG Library and its Documentation).
The computations are stable.
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.