PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_mip_transportation (h03ab)
Purpose
nag_mip_transportation (h03ab) solves the classical Transportation (‘Hitchcock’) problem.
Syntax
[
k15,
numit,
k6,
k8,
k11,
k12,
z,
ifail] = h03ab(
kost,
k15,
maxit, 'ma',
ma, 'mb',
mb, 'm',
m)
[
k15,
numit,
k6,
k8,
k11,
k12,
z,
ifail] = nag_mip_transportation(
kost,
k15,
maxit, 'ma',
ma, 'mb',
mb, 'm',
m)
Note: the interface to this routine has changed since earlier releases of the toolbox:
At Mark 22: |
ma was made optional |
Description
nag_mip_transportation (h03ab) 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_mip_transportation (h03ab) uses the ‘stepping stone’ method, modified to accept degenerate cases.
References
Hadley G (1962) Linear Programming Addison–Wesley
Parameters
Compulsory Input Parameters
- 1:
– int64int32nag_int array
-
ldkost, the first dimension of the array, must satisfy the constraint
.
The coefficients
, for and .
- 2:
– int64int32nag_int array
-
must be set to the availabilities , for ; and must be set to the requirements
, for .
- 3:
– int64int32nag_int scalar
-
The maximum number of iterations allowed.
Constraint:
.
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the first dimension of the array
kost.
The number of sources, .
Constraint:
.
- 2:
– int64int32nag_int scalar
-
Default:
the second dimension of the array
kost.
The number of destinations, .
Constraint:
.
- 3:
– int64int32nag_int scalar
-
Default:
the dimension of the array
k15.
The value of .
Output Parameters
- 1:
– int64int32nag_int array
-
The contents of
k15 are undefined.
- 2:
– int64int32nag_int scalar
-
The number of iterations performed.
- 3:
– int64int32nag_int array
-
, for
, contains the source indices of the optimal solution (see
k11).
- 4:
– int64int32nag_int array
-
, for
, contains the destination indices of the optimal solution (see
k11).
- 5:
– int64int32nag_int array
-
, for , contains the optimal quantities which, sent from source to destination , minimize .
- 6:
– int64int32nag_int array
-
, for , contains the unit cost associated with the route from source to destination .
- 7:
– double scalar
-
The value of the minimized total cost.
- 8:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Errors or warnings detected by the function:
-
-
On entry, the sum of the availabilities does not equal the sum of the requirements.
-
-
During computation
maxit has been exceeded.
-
-
-
-
On entry, | , |
or | , |
or | , |
or | . |
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
Accuracy
All operations are performed in integer arithmetic so that there are no rounding errors.
Further Comments
An accurate estimate of the run time for a particular problem is difficult to achieve.
Example
A company has three warehouses and three stores. The warehouses have a surplus of
units of a given commodity divided among them as follows:
Warehouse |
Surplus |
1 |
1 |
2 |
5 |
3 |
6 |
The stores altogether need
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 |
|
|
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 .
Open in the MATLAB editor:
h03ab_example
function h03ab_example
fprintf('h03ab example results\n\n');
m = 3 + 3;
kost = [int64(8), 8, 11;
5, 8, 14;
4, 3, 10];
k15 = [int64(1); 5; 6;
4; 4; 4];
maxit = int64(200);
[k15, numit, k6, k8, k11, k12, z, ifail] = ...
h03ab( ...
kost, k15, maxit);
fprintf('Total cost = %5.1f\n\n', z);
fprintf('Goods from to\n');
for j = 1:m-1
fprintf('%4d%7d%6d\n',k11(j),k6(j),k8(j));
end
h03ab example results
Total cost = 77.0
Goods from to
4 3 2
2 3 3
1 2 3
1 1 3
4 2 1
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015