James G. MacKINNON*. Queen's University, Kingston, Ont., Canada. This paper describes a new computational Rchnique for solving spatial economic ...
Regional Science and Urban Economics 5 (1975) 445--464. © North-Holland
AN ALGORITHM FOR THE GENERALIZED TRANSPORTATION PROBLEM James G. M a c K I N N O N *
Queen's University, Kingston, Ont., Canada This paper describes a new computational Rchnique for solving spatial economic equilibrium problems which are generalizations of the classic transportation problem. This technique makes use of a type of algorithm which has been developed in recent years to compute Kakutani fixed points at~,~ solve related problems. Existing algorithms for the generalized transportation problem employ quadratic programming, and therefore requtre that demand and supply functions be linear. By contrast, the algorithm of this paper can handle demand and supply relationships which are nonlinear or even semi-continuous. It can also handle nonconstant transport costs and various other complications. The technique is capable of yielding highly accurate solutions, and appear:, to be computationally efficient on problem~ of reasonable size.
1. Introduction This paper describes a computational technique for solving models of economic equilibrium in spatially separated markets. The problems which can be dealt with may be t h o u s h t of as generalizations of the 'transportation problem', which was first posed by Hitchcock (1941). They will th,;refore be referred to as 'generalized transportation problems'. The c o m p e ' a d o n a l technique is a new application of a type of algorithm which has been developed in recent years to compute Kakutani fixed points, and which has been applied to the computation of other types of economic equilibria. The organ;zation of the paper is as follows. Section 2 contains a precise m~.thematical statement of the generalized transportation problem, and some specific examples of such problems. Sections 3 and 4 provide a detailed description of the algl~rithm which is at the heart of the computational technique described in this paper, and section 5 sho" ~s how it may be applied to the solution of generalized transportation problems Finally, section 6 describes computational experience with the technique and presents a numerical example. *I am greatly indt.b'.ed to Professor lt.W. K ahn, who first suggested that transportation problems could be solved by techniques similar to those of this paper, and who read a preliminary draft and made many valuable comme ats. I also benefited from conversations with John Hartwick and Dennis Warner. I alone am responsible for any errors that may remain. This research was supported by the Canada Council.
446
J.G. MacKinnon, An algorithm for the generalized transportation problem
2. The generalized transportation problem The generalized transvortation problem may be stated as follows. There are n sources, i:ldexed by i, and m sinks, indexed by j. The ith source is an economic agent, or a collecti, n of economic agents, which is willing to supply an amount s~ of some good at a unit price of P~. The jth sink is an economic agent, or a collection of economic agents, which is willing to purchase an amount r~j from source i at a unit price of P~. The same economic agents may appear at more than one sink or more than one source, or at both sources and sinks. The good sold by source i may or may not be physically the same as the good sold by source k, but the goods supplied by a particular source are all the same and command the same price. Sources and sinks may be thought of as collections of economic agents at different geographic locations, but this interpretation is not essential. The vector of prices Pt tG P~ will be denoted by P. It is assumed that s~ belongs to S~(P), a scalar-valued correspondence, and that rq belongs to R{(P), the ith element of RJ(P), a vector-valued correspondence. It will be assumed that S~(P) and RJ(P) satisfy the following conditions:
(cs) S~(P) is for all i an upper semi-continuous correspondence which maps from P into a non-negative, convex set Sl. (F)
When P~ = 0, 0 ~ Si(P), and when Pi < 0, SI(P) = O.
(CR)
RJ(P) is for all j a vector-valued upper semi-continuous correspondence which maps from P into a non-negative, convex set R J.
(B)
There exists a scalar, V, positive and finite, such that ~ ' = 1 (~',7= t r u - si) =< 0 for all r u ~ R~(P) and all s~ ~ Si(P), whenever ~ ' = 1 Pi >= V.
, ( C S ) a n d (CR)require no comment. (F) is a consequence of free disposal, that is, the assumption that unwanted goods can be disposed of at no cost. It implies that equilibrium prices will always be non-negative. (B) is a rather strong assumption about the Sl's and RJ's It says that whenever the sum of prices is sufficiently large,/he sum of excess demands is negative. This seems fairly plausible, since one would expect supplies to be large and demands small when prices are high. In particular, if lira
Si(P) ~ H,
for all i
P|--* ~
and 1~1 j~:r'~ < H,
for all
r i~ ~ R~(P)
and all P,
J.G. Mac Kinnon, An algorithm for the g :neralized transportation problem
447
t;:at is, if supply at every source becomes ;ufficiently :arge as its price becomes arbitrarily large, and if demand at every .,ink is bounded from above, (B) will be satisfied. These appear to be reasonable conditions, but thev may not always be satisfied in practice. Happily, (B) is a sufficient condition not a necessary one. There are apparently many models which fail to satisfy (B) that nonetheless can be solved by the techniques of this paper. An equilibrium is defined as a set of prices, P,, supplies from source i, ?,, and flows from source i to sink j, ~i, such that ~,~ S,(P),
for all i,
(E.1)
~,j E R~(P),
for all t and j,
(E.2)
for all i.
(E.3)
and m
~- ro = gi,
J-!
(E.I) through (E.3) clearly describe what is normally meant by at. equilibrium. (E.I) and (E.2) ensure that, given prices P, no agent would prefer to do anything else, and (E.3) ensures that total demand at every source is equal to supply. The general model described above seems to bear little resemblance to either the transportation problem or to spatial models of economic equilibrium. It may therefore be helpful to consider two simple examples. The first example is the classic transportation problem. In this case S,(P) = S,, a non-negative constant, for all i. It costs c o to transport one unit from source i to sink j. Thus the cost of source i's goods delivered to sink j is Pl = P, + c o. The demand for goods from all sources at each sink is ,~j, a non-negative constant. It happens that III
III
YS,= ,-1
For all j,
j=t
R~(P)is the set ofall r o such that II
Y r,j i=1
and r0=0,
if Pl > p ~
for any
k~i.
Thus sink j alway~ demands a total amount .~j, which it is willing to buy from a~y source so long as no other source is cheaper. It is easily verified that for the classic transportation problem (CS), (CR) and (B) are satisfied, but (F) is not. It turns out that this problem cannot be solved
448
J.G. MacKinnon, An al#orithm for the generalized transportation problem
by straight-forward application of the techniques of thi:, paper, because there are infinitely many price vectors that solve it, since only the differences between prices matter. However, a simple modification, which involves normalizing prices to sum to a constant that is sufficiently large, can be used successfully. Since standard techniques are available for the classic transportation problem, this modification will not be discussed further. An obvious generalization of the classic transportation problem is to make ,~ and ~J depend linearly on prices. Suppose that
Sl = (a~+b~Pi) I(P~), where b~ is positive and I(PO is a correspondence which is unity for all P~ > 0, and the closed interval between zero and one for P~ = 0; this ensures that (F) is satisfied. Also suppose that
(
)
Rj = dj-fj min [P,+cij] , i
where dj and fj are positive. This model clearly satisfies (CS), (CR) and (F). To see that (B) is satisfied, consider the sum of excess demands, which is just the sum overj of Rj minus the sum over i of,~, or
~"dJ-~"~ a~l(P~)-~f j ~ (min i [P~+c°])-~ .
(1)
Expression (1) will clearly be n~.gative when the sum of pri~es is large enough (since the last two terms will dominate the first two), so (B) is satis:'ed. A variety of models similar to this have been ~olved by Takayrma and Judge (1971), using the technique of quadratic programming. Some of the models they solve involve two or more goods. These differ from single good models only in that ,~ and Rj depend on more than one price, and cij is prohibitively large if source i and sink j deal in different goods. They also solve models in which sources and sinks are located in time rather than in space, and models in which there are barriers to trade such as tariffs and quotas. Since Takayama and Judge use quadratic programming, they are restricted to using linear demand and supply functions. No such restriction applies to the techniques of this paper. Si and ,~j may be nonlinear functions or even correspondences, and the computational burden turns out to be largely independent of how complicated or nonlinear they are. Thus Rj(P) might be the stimma?.ion of a number of different demand functions by different users located at the same sink. Many other generalizations of the classic transportation problem are i:ossible. For example transportation costs can be made to depend on prices (see the section on computational experience, below).
J.G. MacKinnon, An algorithm for the generalized transportation problem
449
3. The Vector Sandwich Method In order to find st, r,j and P which satisfy (E.1) through (E.3), it is necessary to employ an algorithm which is capable of finding the zeros of a system of convex upper semi-continuous correspondences (that is, upper semi-continuous correspondences which map into convex sets). Several algorithms capable of doing this have been developed in recent years, and have been applied to certain non-spatial economic equilibrium problems and to computing Kakutani fixed points. The first such algorithm was due to Scarf (1973), and more efficient and general algorithms have been proposed by Merrill (1972) and Eaves and Saigal (1972). Techniques very similar to those proposed in this paper could be used in conjunction with either of the latter two algorithms. However, the algorithm which is actually used differs from both in some respects. This algorithm, which "s called the Vector Sandwich Method, bears some resemblance to that of Merrill, although it derives chiefly from the work of Kuhn (1968) and Kuhn and MacKinnon (1975). It is necessary to describe the Vector Sandwich Method in some detail in order to show how it may be us, d to solve generalized transportation problems. The discussion is self-contained but necessarily terse. A simple introduction to some of the main ideas may be found in MacKinnon (1974). The Vector Sandwich Method is an algorithm for finding approximate solutions to problems in the following i'orm. There is a real vector; x, with components xl to XN that are non-negative and sum to one. There is a vectorvalued, convex upper semi-continuous correspondence F(x) with N real elements Fl(x) to F~(x) that sum to zero. It is assumed that Fi(x) is non-negative when x~ is zero. The problem is to find ~ such that F~(~) contains the origin for all i. This problem is essentially the same as the geDeral equilibrium problem for an economy with production, which is guaranteed to have a solution by the Debreu-Gale-Nikaido Lemma [see Takayama (1c74, p. 263)]. The proof that the algorithm provides an approximate solutior to this problem does not depend on that lemma, however. Since the components of x are non-negative arid sum to one, x lies on the u,~it simplex of dimension N - 1 . A simplex is de'ined as the set of all points that can be expressed as convex combinations of N affinely independent vertices; in the case of the unit simplex these vertices are t!, 0 , . . . , 0), (0, 1, 0 , . . . , 0) and so on. A simplex has N faces, which are the ( N - 2 ) simplices formed by dropping each of the N vertices in turn. Any simplex can be subdivided so that each of the parts is a simplex, and so that if any two subshnplices share a common boundary of dimension N - 2 , that b Jundary is a face of both of them. This fact is crucial to the operation of the algorithm. One method of subdividing the unit simplex is the regular subdivision, which is described in Kuhn (1968). Every vertex of a subsimplex in a regular subdivision of the unit simplex can be expressed as (XI/D, X:/D,
450
J.G. MacKinnon, An algorithm for the generalized transportationproblem
. . . , XN/D), where D is the degree of the subdivision, a positive integer, and X~ to XN are non-negative integers that sum to D. Indeed, any N non-negative integers that sum to D describe some vertex of the D subdivision of an ( N - 1) simplex, in the sense that they are equal to D times the coordinates of some vertex. Fig. 1 shows a 10-subdivision of a 1-simplex and an 8-subdivision of a 2-simplex.
(i,o) (0,0,I)
(I,o,o)
(o,I,o} Fig. 1
Proposition 1. I f x t and x 2 are vertices o f the same subsimplex in a regular subdivision o.i"degree D, then none o f their co-ordinates can differ by more than
1/D. This p3roposition is proved in Kuhn and MacKinnon (1975). It implies that as D tends to infinity, the distance between any two points in a single subsimplex tends to zero. If X, through XN are non-negative integers which sum to D, they describe some vertex of the D subdivision of an ( N - 1 ) simplex. Suppose that X = (X1, X 2 , . . . , AN, 1). The vector X must descril:e a vertex of the ( D + 1) subdivision of an N simplex. Thus the subdivided ( N - 1 ) simplex which is really of interest [because it contains a zero of F(x)] may be embedded in the subdivision of an N simplex. We shall denote the latter by S N, and the subdivided ( N - 1) ,,~implices which are embedded in it by S~ -1, S~ -1 and so on, where the subscript refers to the last component of all vertices. For the case of a l-simplex, this is illustrate, d in fig. 2. From the figure it is easy to see where the 'sandwich'
.~,,G.M~tcKinnon, An algorithmfor the generalized transportationproblem
451
in the name of the algorithm comes from, because the original simplex, S~ -1, has been sandwiched between SoN -1 cud $2N-t. The other layers of S N, S~'-~ and so on, play no part in the algori'hr t end are therefore not shown. F o r the purposes of the algorithm, every vertex of SoN- t and S ~ - 1 has associated with it a label, which is a real vector with N elements, t If X (an inl!eger vector summing to D + 1) describes a vertex of S O N- , then it is labelled by the following rude"
L°(X) = Wi- Xi+ l,
fo," i =
ltoN,
(2)
where Wl is the ith component of W, which may be any vertex of S~ -1. This artificial labelling rule is adopted so that the algorithm may start near W; thus W/D should be the best available integer approximation to ..7. •
,
.
.
.
.
,
,
,
3N-I
N-i S0
Fig. 2
If Xdescribes a vertex of StN- ~, it is labelled by the rule
L~(X) = f~(X/D)+ 1,
for
i = 1 to N,
(3)
where fi(x) is some element of Fl(x). We shall denote the label which is associated with a vertex X by L(X), where it is understood that L(X) = L°(X) if XN+I = 0, and L(X) = L I ( X ) i f XN+I = 1. Vertices of S~ -1 for M > 2 are never encountered by the algorithm, and therefore L(,t) is not defined for XN + 1 ~-->2. Suppose that X t through X N are N of the N + 1 vertices of some subsimplex of S N. The vector labels associated with these vertice:, which we shall denote by L 1 through L N, may be formed into an N by N matA ~ A, where the ith column tThis explains the 'vector' in the name of the algorithm. An earlier algorithm, which was simply called the Sandwich Methe:l, used integers between 1 and N as labels. See Kuhn and MacKinnon (1975). Integer labelling algorithms cannot be used to solve problems which ar" not continuous.
a52
J.G. MacKinnon, An algoritJamfor the generalizedtransportationproblem
of A is L ~. Now consider the system of linear equations A2 = b,
(4)
where b is ( 1 , . . . , 1)'. We shall suppose that A -a exists so that (4) has a solution. Using the terminology of linear programming, this will be called a feasible solution if 2~ _-> 0 for all i. If the solution to (4) is feasible, A will be called a
feasible basis. Suppose that L* is some other column vector, perhaps the label of some other vertex in S N. It is always possible to find some i such that when L t is removed from A and L* put in its place, the new matrix A* is still a feasible basis. This is a well-known theorem from linear programming; see Scarf (1973, theorem 4.3.2) and Ga3e (1960, theorem 4.1) among others. The very simple computational procedure that is used is described in section 4, below. If A and A* are non-degenerate- that is, if 2~ > 0 for all i, for both A and A * - t h e r e is only one possible choice for i. It will be assumed that this non-degeneracy assumption is satisfied. Computational experience suggests that it is almost always true in practice, and some auxiliary technique, such as a perturbation of b, can l~ invoked if necessary to make the choice of which L ~to replace unique. The Vector Sa.ndwich Method ope;-ates as follows. Suppose that X ~ through X N are all vertices of some subsimplex of St;; indeed, unless they lie on an exterior face of S ~, they must belong to precisely two subsimplices, ( X l , . . . X N, X') and ( X I , . . . , X N, X*). Suppose that A = ( L 1 , . . . , L N) is a feasible basis, and that the vertex X' has just been dropped and replaced by, say, X ~. The next step is a basis change, which involves bringing L* into A and dropping one of X ~ to X N. By the non-degeneracy assumption, the vertex to be dropped is unique, and we shall suppose it is X N. The vertices whose labels are in the basis are now X l through X N-~ and X*. Unless they lie on an exterior face of S N, there is some vertex X *~' such that (X ~, . . . , X N-~, X*, X**) are the vertices of a subsimplex. Dropping X N and replacing it with X** is a pivot, and in the case of the regular subdisivision there are simple rules for performing such pivots (see below). The next step is to bring X** into the basis, which will cause another vertex to be dropped, which will require another pivot, and so on. Basis changes and pivots alternate as the algorithm proceeds through S N, always maintaining a feasible basis made up of the labels associated with vertices of a single subsimplex. The Vector Sandwich Method can never cycle; that is, if X 1 through X N have once provided a feasible basis for the algorithm, they can never do so again. The reason is that because the vertices which are dropped in basis changes and added in pi ,ots are always unique, ( : ( z , . . . , X N) can be reached from only two adjacent positions- (X', X Z , . . . , X ~) and ( X I , . . . , X N-l, X*), to use the notation of the previous paraglaph. If ( X ~ , . . . , X N) has already provided a feasible basis for the algorithm, so must the two positions adjacent to it. This
J.G. MacKinnon, An algorithm for the generalized transportmion problem
453
holds for all possible bases, of which there are a Enite number because, as will be proved below, the algorithm can never exit from the simplex. Thus either the algorithm has no beginning and no end, in which case it w~uld cycle forew.% or, if there is some basis which can never be revisited, no basis can ever be revisited. Ir~ fact, the algorithm starts at a unique basis which can never be visited more than once (see the next paragraph). It follows that the Vector Sandwich Method can never cycle. Arguments similar to the foregoing were first used by Lemke and Howson (1964), and are also crucial to the algorithms o f Merrill (1972) and Eaves and Saigal (1972). Consider the subsimplex with vertices Z ~ to Z N+ ~, where Z J --'~ I/J/rj"~"f~j, l -- ~ j, N + l ,
for
i=
ltoN+l.
(5)
~ij. ~is the Kronecker delta, equal to one when i = j, and equal to zero otherwi:~e. ~,N- - 1 • Z ~ through Z N lie on SoN-I, while Z N+l is equal to W, and th,~ lies on ,-'1 By rule (2), the labels associated with Z 1 through Z N are (0, 1 , . . . , 1), (!, 0, 1, •.., 1) and so on. If these are formed into a matrix, A, the matrix is 0 1...1 ] A=
10
:
(6)
i ...... 6 A -1 is a matrix with - ( N - 2 ) / ( N - 1) everywhere on the principal diagonal and 1 / ( N - 1 ) everywhere else. Thus 2t = I / ( N - 1 ) for all i, and A ~s therefore a feasible basis. Z t through Z N thus provide a starting poir.t for the algorithm. The next step is a basis change in which Z N÷ ~ is brought in a:~d one of the original vertices is dropped, and the algorithm then proceeds in the manner described above. The Vector Sandwich Method thus starts off with a subsimplex whose vertices, Z 1 to Z N• 1, belong to SoN- 1 and S N- 1. The number of subsimplices ~'hich belong to those two layers of S N is finite for finite D, and, by the non-cycling argument, the algorithm can visit each at most once. Thus at some point the algorithm must exit from the subset of S s consisting of S~'-1 and S N-l. There are three ways it can do so. Either it can go back through SoN-~, or it can leave the simplex by some other route, or it can exit through S N- t. If the algorithm exits through S N- t it will, in a sense to be explained more fully below, provide an approximate solution to the problem. It will now be shown that the other possibilities can be ruled out. if the algorithm eyits from the simplex, it must pass through one of the N + 1 faces of S s. Every vertex on the ith face of S s has an ith coordinate of zero, and every subsimplex which 1ouches the ith face must therefore, by Proposition 1, have a 0 or a 1 as the ith coordinate of all its vertices. In order
454
J.G. MacKinnon, An algorithm for the generalized transportation problem
for the algorithm to exit from the simplex, it must drop a ,,ertex with an ith coordinate of 1 and pick up a vertex with an ith coordinal of - 1. By Proposition 1, this can only happen if all the other sertices of the current subsimplex have ith coordinates of zero. Thus for such a pivot to occur, the N vertices on the ith face (all of which have ith coordinates of zero) must provide a feasible basis. To show that the Vector Sandwich Method can never exit from $;¢, it is sufficient to show that no N vertices which belong to the same subsimplex and lie on a face of S N can ever pro¢ide a feasible basis, with the sole exception o f Z ~ to Z ~, which provide the unique start. The following proposition, which bears no obvious relation to the foregoing problem, will prove to be essential. We denote by 2j the j t h element of 2, by Lo the set of 2j's which are associated with columns of A that are the labels of vertices of Sg -~, and by L~ the set of 2j's which are associated with columns of A that are the labels of vertices of S~- ~. H
Proposition 2.
= I +(I/8) JeLo
=
;'roof AI N i=1
b. Since b sums to N, it follows that
=
A,j j
=
(7)
N.
If j belongs to Lo, ~ v ~AU = N - 1 ; this follows immediately from labelling rule (2) and the fact that the first N elements of W sum to one less than the first Neleme, l!s of any X on SoN-~. I f j belongs to L~, ~ffi tA~j = N; this follows from labelling rule (3) and the fact that ~ - - l f ~ ( x ) = 0 by assumption. Using these facts, we may rewrite (7) as leLo
JeLt
(8)
Sincej l~.longs either to Lo or to LI, (8) may be rewritten as N
Ns_~I J - ~ 2j = N. Jel.o
(9)
Dividing both sides of (9) by N and rearranging terms yields Pi'oposition 2. Q.E.D. Some implications of Proposition 2 should be noted. When all the columns of A are labels of vertices on S~;'- 2, the sum of the 21s is equal to unity. When all the columns of A are labels of vertices on Sos-~, the sum of the lj's is equal to N/(N-1). And when some columns of A come from both layers, the sum of
J.G. MacKinnon, An algorithm for the generalized transportat; ,~problem
.~55
the 2j's must be greater th,an one, because, by the non-degeneracy as:~umption ,~j is greater than zero for allj. Proposition 3. Proof
Z 1 through Z ~ provide the only feasible basis on S ~ - 1o
The ith row of (4) is N
~ A o A J = 1.
(10)
J=
Since 2j must be positive and ~ _ 12~ must be greater than one, (10) cannot hold if A u is greater than one or less than zero for all i. Since we are conc~rrJed with vertices on SoN-l, rule (2) must be used, so A o ~u:~t be an integer. The coordin.ates of vertices in the same subsimplex cannot differ by more than one,. so A o must be either 0 or 1 for all i and j. (10) could obviously not hold if Aij were 0 for all j or 1 for all j fo~ any row, so each row must contain entries of 0 and entries of one. It follows that if X ~ through X N are to provide a feasible basis on S~'-1, X~ must be equal to I4~ or W~+ 1 for all i and k. The other vertex of such a subsimplex mu~t be W, since for any other vertex on S~ -~, X~ + 1 would differ from X~ by 2 or more for some i and k. It has been shown by Ktthn (1968) :hat all the subsimplices to which any vertex V belongs can be characterized ~ follows. Let E k be a vector of N + 1 elements with 1 in the kth position, - 1 in the ( k - 1)st position ( k - 1 = N + 1, if k = 1), and 0 everywhere else. Let P ~ any permutation of the first N + 1 integers. Then the vertices of the subsimplices to which V belongs can be generated by V N+I = V, V 1 = V N + I - , ' - E P(1), V 2 = V I - I - E P{2), and so on. Now consider the subsimplices to whi,: ~, W belongs. We shall show that if their other vertices, V1 to VN, are to lie on Sg-x and provide a feasible basis, P(A) must be k for all k. Suppose instead that P(I) is not one. Then V~ + 1 will be 1 "ather than 0, so V~ will not lie on S g - z. Thus P(1) must be 1. Now suppose th ~t P(2) is not two. Vff must be W~- 1 for some i (since V~ is the only el.~ment of V1 that is greater than the corresponding element of W). This contradict.~ the assumption that V~ through VN provide a feasible basis. Thus P(2) must be 2. The identical argument holds for P(3) through P(N), so it has been shown tha~L P(k) - k for all k. But in that case, V~ = Z ~, Vz = Z z, and so on. Thus the only feasible basis on SoN- 1 is Z 1 through Z N. Q.E.D. Proposition 4. I f V~ = Of o r any i f r o m 1 to N and f o r j = 1 to N, V 1 through V N cannot provide a feasible basis. Proof Consider eq. (10) again. If Vj = 0, A~j ~ 1. This follows from the facts that f~(x) ~ 0 if xl = 0, and that W~-C > 0; the ith element of the label is Wi+ 1 for rule (2) and ~ ( x ) + 1 for rule (3), ¢o it must be at least one. By
456
J.G. .MacKinnon, An algorithm for the generalized transportation problem
Proposition 2, the sum of the 2/s is strictly greater tt~an one, and of course 2s is positive for all j. Thus (10) obviously cannot hold, and V~ through VN therefore cannot provide a feasible basis. Q.E.D. Propositions 3 and 4 ensure that, once the Vector Sandwich Method is started at Z 1 to 7 N, it can never leave S N. Since it must leave S~' - t and S~ -1 evertually, the algorithm must exit through S~ -~. It must therefore find a t~asible basis entirely labelled by rule (3). We denote the vertices of S~ -1 whose labels form the columns o i A by X ~ to X N. Then the/jth element of A is
Z(XJ/D)+ 1, and the ith row of (4) is N
N
j=l
j=l
E~(XJ/D)2j+ ~., 2j = 1.
(11)
By Proposition 2, the sum of the 2/s is one. Thus (11) implies that N
~.,~(X~/D)2j=
O,
foralli.
(12)
j=l
Now suppose that we allow D to increase without limit, so that to some point ~ for allj. Then (12) implies that
XJ/D converges
N
Ef~J(~)),j = O,
for all i,
(13)
j=l
where the j superscript on f/(£) indicates that f~J(2) need not be the same for all j, since f~J(2) is just some point belonging to F~(2). The convexity of Fi(2) implies that since f/(2) belongs to F~(2) for all i and j, the weighted sum of the f~i(2)'s which appears in (13) mu~t also belong to F~(2). Thus the vector .2 is a solution to the problem. in practice it is not possible to let D increase withol.t limit. For finite D, (12) can stiil be interpreted as an approximate solution to the problem. Consider the piecewise linear function which is defined as follows. For any D, a vertex x on the simplex can be expressed as N
x = ~ # j x j,
(14)
$=1
where x I through x N are the vertices of a subsimplex to which x belongs, and /~t through/~N are non-negative weights that sum to one. The ith component
J.G. MacKinnon, An algorithm for the generalized transportation problem
457
of the piecewise linear functior~ g(x) is defined to be N
g,(x) =
j=l
,f,(xJ),
(l 5)
where f~(.vJ), as before, is any element of Fi(xi). The function g(x) is a piecewise linear approximation to F(x), and for D sufficiently large one would expect the approximation to be very good. Thus one would expect that a zero ofg(x) would be close to a zero of F(x). Now consider expression (12). It is clear that (12) defines exactly a zero of (15), with 2~ substituted for #j. The value of xi for which g(x) is zero is, from (l~.), N
x, = ~ 2j(Xi/D),
for
i=
1 to ~V.
(16)
j=l
Thus the Vector Sandwich Method finds exact solutions to piecewise linear approximations to the original correspondence, F(x). For another and more elaborate discussion of the sense in which algorithms of this type provide approximate solutions, see Scarf (1973, ch. 4).
4. A detailed description of the Vector Sandwich Method The actual mechanics of basis changes and pivots have not been discussed up to this point, and nor has anything been said about the choice of D and W. This section aims to remedy such omissions by providing a concise description of the algorithm, sufficiently detailed so that it could serve as the reference for a computer program. As is customary in computer programming, the equals sign is to be read as an assignment statement, not as an algebraic equality. The program presep~ed here does not deal with the possible problem of degeneracy, although it does check to see that the non-degeneracy assumption is satisfied. In practice, this problem has occurred very rarely indeed. The main arrays used are A-1, an N x N real matrix, which is the inverse of A (not needed by the algorithm); X, an ( N + I ) x ( N + 1) integer matrix, the jth row of which sums to D and contains the coordinates of the jth vertex; and V, an integer vector with N elements, Vk being the row of X to which the kth row of A- l corresponds.
[ll
i,j - 1 to N + I .
Xjl = Wi+fii.i--fii,N+l,
for
A~ t = - ( N - 2 ) / ( N - 1 ) ,
if j = i ,
=
[j =j, E=N+I
I/(N-
otherwise.
1),
for j -
ltoN.
to denote that vertex N4.1 is to enter.
458
J.G. MacKinnon, An algorithm for the generalized transportationproblem
[2] L = !" ~Xn), where L( N
) is either rule (2) or rule (3). N
rj - E A~ 1 andsj = Z A;tL, • i=l
i=l
Replace the kth row of A -~ if & -- 6 and (rJsk) < (rflsj) for all j with sj > 0. If rj = 0 for any j or k is ,aot unique, degeneracy has occurred. Change D and go back to [1 ]. [3]
U p d a t e A - I . A ~ l = A~l/sk.
A~ ~ = A ~ J - s j A ~ ~, [4]
for j ~ k.
Drop vertexj = V~. Vk = E and E = j. for
x., = x,_,.,+
i= ltoN+l.
IfXj,N+t # 2, goto [2]. N
[5] ' ~ v = ~ A ~ t,
for j =
ltoN.
i=l N
#, = ~ 2jXv,,k,
for
k = 1 to N.
$=1
If BID is a sufficiently good approximation, stop. Otherwise, set D = rD (where' r > 1, 3 perhaps) and make W an integer approximation to rB. Go to [1].
5. Application to generalized transportation t,roMems
~ l e Vector Sandwich Method can easily be applied to the solution of generalized transportation problems. The key is t e define a function f(x), where x is on the simplex, such that when labelling rule (3) is used with f(x), the feasible basi:: through which the algorithm penetrates S~ - t provides an approximate solut~,m to (E.1), (E.2) and (E.3). First, we establish a rule which maps from the unit simplex to the non-negative orthan':. Let N, the number of vertices of the oimplex, be equal to n + 1, one more than the ,mmber of sources. The map from the simplex to the prices as:,ociaced with the sources is
P i = xi/xN,
if Xu > I/V
Pi = xiV/(1--XN),
otherwise,
for
i = 1 to n,
(17)
J.G. MacKinnon, An algorithm for the generalized trans~ortation problem
459
where V is the (probably large) number which is : ~_¢a=.ed to exist by (B). (17) implies that no point on the simplex maps into a vector of prices which sums to more than V. In order to rule out the possibilit,: that more than one verte: of the simplex may map into the same price vectc,', it will be assumed that V is at least as great as D. For finite D, this is a comp!eteiy ~nnoeuotis assumption, since if (B) holds for some V it holds for all V grec~ter ~.han V. This assvmption implies that P~ is equal to XJXu everywhere except o~ the face of the simplex where XN = O. Given xt to XN, P~ to P, are determined by (17). We may now choose s~ belonging to SI(P) and r o belonging to R~(P), for all i and j. If Si(P) and R{(P) are set-valued at P, the choice may be arbitrary, except that s~ must be zero when P, is zero [which is a legitimate choice beea ase of assumption (F)]. Given these choices of s~ and r o, f(x) is defined by wll
fi(x) = ~, r o - s i , j=l
for
i = 1 to ? , - 1 ,
and N-1
fN(x) =
-
(18
EA(x). i=1
It should be obvious that the function defined by (18) has all the properties tb t f ( x ) was required to have in section 3. The choice for fN(X) ensures that Ja ~x) throughfN(x) sum to zero. Since si = 0 when Pi = O,fi(x) must be non-negative whenever x~ = 0, for i = 1 to N - 1 . Assumption (B) ensures that fN(X) is non-negative whenever XN = 0. These were the only properties off(x) that were usec by Propositions 2, 3 and 4. By Propositions 3 and 4, then, if the Vecto~ Sandwich Method is applied to a problem in which S~ -1 is labelled by rule (3) usingf(x) defined by (18), the algorithm must eventually terminate with a feasible basiz entirely on S~ -1. That is, the Vector Sandwich Method must terminate with N vectors x k and N 2k'S (which sum to unity by Proposition 2), such that N
~f~(xk)Ah -- 0,
for
i -- 1 to N.
(19)
k=l
The values of s,, r o and P, at x k may be denoted by s k, rijk and pk. (18) and (19) imF ly that for k = l\J=
1
i = 1 to n.
(20)
460
J.G. MacKinnon, An algorithm for the generalized transportation problem
We may now define N
P, ---: ~ P~Ak,
for
i = 1 to n,
for
i=
for
i = 1 to n,
k=l N
gi=
~s~gtk,
(21)
Iton,
k=l N
~,! = ~ r~2 k,
and
j ~- I to m.
k=l
These provide an approximate solution to tr,~ generalized transportation problem. First of all, it is clear from (20) that g, and ~,j satisfy equilibrium conditions (E.3) exactly. That is, total demand at every source is exactly equal to supply. It is also clear that if D were infinitely large, so that x k were the same for all k, (E.I) and (E.2) would also be satisfied exactly. The facts that s~ ~ S,(pk), PJ' = P and S,(P) is convex would ensure that si ~ S,(P), which is (E.I); and for similar reasons rij ~ R{(P), which is (E.2). In practice, however, D must be finite, and (E. 1) and (E.2) will therefore not be satisfied exactly. It is easily seen, however, that gi and ~o belong to piecewise linear approxJmatior~s to S,(P) and R{(P), where these are defined in exactly the same way as g(x) was in section 3 above. It seems reasonable to believe that ~hen D is sufficiently large, ~hese piecewise linear approximations will be very good, so that (E.1) and (E.2) will be satisfied as good approximations. My comr atationai experience, which is discussed below, bears out this belief.
6. Computational experience The technique of this paper has been used to solve a number of reasonably small artificial problems (n < 10, m ~ 50),. and has been signally successful. It appears to be capable of yielding highly accurate answers, 2 which may be more accurate than those yielded by algorithms that are supposed to give exact answers. As an example of this, the technique was applied to the problem which is discussed by Takayama and Judge (197!, pp. 247-250). This problem has two goods and three regions, for a total of si~