3 3..I.
Memoranda
The Urban Postman Problem THE POSTH,a.N15roblem
is the problem of finding the minimal distance route for a p o s t m a n who must traverse each street of his district at least once and return to his starting point. Recently Minieka [3] surveyed available solution techniques, and examined the problem in various application contexts for three types of street network: (1) the undirected network, in which the p o s t m a n can traverse each street in either direction: (2) the directed network, in which the p o s t m a n must traverse each street only in the specified direction: and (3) the mixed network, which is the combination of the first two. In this note, we consider the p o s t m a n problem for the street network characterized by alternating one-ways, else serviced by alternate-side schedules. We shall call such a network the urban network. Let N = (V, E) be any connected network where edge set E represents the set of street blocks to be traversed and vertex set V represents the set of edge intersection points. Most of the existing solution techniques initially deal with the question of how to repeat any edges, if necessary, so as to minimize the overall distance traveled. E d m o n d s & Johnson [2] and Christofides [1] solved this latter problem as a matching problem when N is undirected. For the cases where N is directed or mixed with an even degree for every vertex, E d m o n d s & J o h n s o n employed the concept of m i n i m u m cost flow. (The vertex degree is the number of edges incident to the vertex.) Minieka [3] proposed to solve the problem as a flow with gains problem when N is a general mixed network. By duplicating each edge whenever it need be repeated, the p o s t m a n problem then reduces to
the well-known problem of finding a Eulerian cycle in the expanded network. Taking advantage of the special characteristics of the urban network, we shall develop a simple algorithm which will directly find an optimal p o s t m a n route, URBAN NETWORK The street network in urban areas typically consists of a set of streets ', S,I and another set of cross streets IAj',. i = 1,2 . . . . . re, j = 1.2 . . . . . n. (See Fig, 1.) For convenience, we shall call I Sil the street set and I A.~: the avenue set. The set I S~ I is said to be independent if no two S~ intersect with each other. The same characterization of independency applies to I Aj',. We define the urban network tUN) as a network consisting of ', S~', and ',A i',. both of which are independent. Note that there are n(m - 1) + m(n - 1) street and avenue blocks in the UN. The boundaries of the U N consist of A~, St, A,, and S~. Although the U N m a y be such that S~s or Ajs, or both, are parallel within the corresponding set, we shall not make such an assumption. The regularity occurring in edge directions, however, is important to the development of our algorithm. The U N may be undirected, directed, or mixed. If directed, the UN would often be such that all the edges in I S~I have the same direction. Further, the direction for S~ and that for S~..t may alternate, all i = [ . . . . . m - 1. We call such I S~', the alternatin 9 street set. The same regularity may occur to I At ',. We say that the given U N is an ahernatin 9 UN if both ~S~}
A r
,,48
11,27
(-)
(+}
(-}
' 3
281
(+)
121
S,
"
[7
(-)
(+)
4
,19
- 8,20
9,
(+)
(-)
r ° , •.mS 2~' (+1
(-}
,e,
21
(+)
(-)
}(
15
13 $6
t4,26
(+)
2 (__)
Ii (,+)
6
5
18
i
(-)
17,25 (+)
(-)
FIG. 1, Example f o r olternatin 9 UN. The po.strnun route is shown b y the sequence o f numbers.
Omega, Vol. I0. No. 3 and ; .4j: are alternating sets. IAs an example, take the street network for some parts of New York City.I While an alternating UN is a special case of the directed UN, one can easily conceive such a network existing within the structure of an undirected or mixed UN. For instance, consider the situation where an undirected UN is subject to an "alternate-side" service policy. That is, only one specified side (one-way) of each S~ (and ,4~1 is serviced in a given day's schedule, and the other side (one-way) is serviced in the next day's schedule. (In New York City. street sweeping and refuse collection are performed in this manner.) As such. a service schedule may easily be made up in such a way that the network to traverse is an alternating UN. In fact, such a schedule would result in a smaller total distance to travel on both sides. Similar arguments hold for the mixed UN. Given a vertex x. let In(x) denote the number of edges directed into x and Out (x) denote the number of edges directed out of x. Noting that the postman must always enter and exit x an equal number of times [3]. the postman must repeat some of the edges incident to x if In(x) :e Out(x). Call such a vertex an odd vertex, otherwise call x an ecen vertex. For each odd vertex x in Fig. 1. ( - ) i n d i c a t e s I n ( x ) - O u t ( x ) = - I , and ( + ) indicates I n ( x ) - O u t ( x ) = + 1. Note that the signs alternate along any given boundary but that the alternating order changes along its opposite boundary. Given a boundary, the alternating boundary edyes consist of two corner edges and those edges directed from a ( + ) vertex to a ( - 1 vertex. Figure I illustrates the alternating boundary edges by heavy lines.
AN A L G O R I T H M FOR A L T E R N A T I N G UN Remark 1 concerns the feasibility condition for the postman route. Remark 2 establishes a basis for identifying the optimal route.
Remark I A feasible postman route exists in an alternating UN if and only if every corner vertex of the UN is an even vertex. The following observations, though not formal, constitute the main part of the proof for Remark I. In any corner vertex xi is not an even vertex, then ln(xi) - Out(x~) is + 2 or - 2, i = 1, 2, 3.4. If it is + 2, then .,q is a "trap" point from which the postman cannot depart in any direction. If it is - 2, then at least one of the other three corner points is a trap point. Note that if there exists a feasible route, there must be an even number of streets and an even number of avenues. This is due to the alternating nature of the directions in the network. Remark 2 For any feasible postman route for an alternating UN, every alternating boundary edge must be repeated at least once. Remark 2 is based on the fact that the postman must enter and exit each vertex an equal number of times, in particular, each odd vertex. In an alternating UN all odd vertices appear only on the boundaries. Based on Remark 2. any route is optimal if it repeats only alternating boundary edges exactly once. Assuming that a feasible route exists in the given alternating UN. we now present our algorithm for finding such a route. For a meaningful analysis, we assume that the network has more than two streets and more
335
than two avenues. The algorithm always makes straight movements to traverse any interior street or avenue.
Algorithm We first give the following informal description of the algorithm: (l) If the postman is on a boundary of the network, he must "enter" the network via the closest interior street or avenue. (2) Once he is on an interior street or avenue, he must traverse it in its entirety and "exit" the network to reach a boundary. The following is the formal description of the algorithm. While the starting point, say S, can be any point on the network, we choose an interior point for S. (1) Proceed straight to the end of the street or avenue. Make a turn at the 1+) vertex. {2) Proceed along the boundaries to the first ( - I vertex. 131 If the ( - ) vertex leads to a totally untraversed interior street or avenue, make a turn and go to (I). Otherwise, go to (41. (4) If the ( - ) vertex directly leads to S and the straight path connecting the [ - ) vertex and S is the only part of the network untraversed, make a turn: otherwise, go to 12). Proceed to S and stop.
We apply our algorithm to the network of Fig. 1, with S on A.,. The resulting postman route is indicated by a sequence of numbers for turning. The route is optimal since each of the alternating boundary edges is repeated only once and no other edge is repeated. The algorithm does not require the information on edge lengths. More important, it finds the optimal route directly without solving a flow problem [2]. It is interesting, however, to note that the transition from a (+1 vertex to the first available ( - ) vertex is analogous to assigning a sink to the miniumum cost source in the flow approach. We provide a proof for the optimality of our algorithm.
OPTIMALITY OF THE ALGORITHM Consider initially the alternating UN shown in Fig. 2. (We shall comment shortly on some other network structures.) The network consists of m streets and n avenues, where both m and n are even numbers. Some vertices are numbered as ct. c.,. . . . . etc. The starting point S is an interior point along the avenue A~. Since no interior street or avenue is repeated by the algorithm (this should be clear by Steps (1), (3) and (4)), we shall concentrate on Step (21 to show how the entry via "the closest ( - ) vertex" yields an optimal route. More specifically, our aim is to establish for any boundary: (11 only alternating boundary edges (ABE) are repeated once each, (2) none of the remaining boundary edges (RBEI is repeated. We divide the postman's route resulting from the algorithm into the following seven subroutes denoted by a i ~ h~. each beginning at the point a~ and ending at the point h,. i = 1.2 . . . . . 7. These are in the order
Memoranda
336
Az (-)
,4 i
Ai_ ~ ,Zl; (+) (-} v, K
I !
( - ) ~( +] I-,,.- . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
I I
An_ i A n (+) v2 v3 . . . i ~ (_} J I
r-
-~ I.. - - ~ - . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
-
'~IC+) --
"I' ( - )
I I I I I
I
I" (-)
i--
(+) t'--
S,.,,
: vs
-
"
. . . . . . . . .
............
~ vr
(+)
i--'i
. . . . . . . . . . . . .
............
r-t
. . . .
I-.
Y.
vs
v/
"-"
(+1
"
- - t t-I v~
(-) (+)
v4
(-)
FIG. 2. Alternatiny UN. of travel: (1) S---, v3 (2) e~ ~ v3 (3) vj ---, r,t (4) v4 ---* t'; (5) v~ ---, v8 (6) v8 --* ~'9 (7) v9 ~ vi --' S. The traversal by each subrou~e is as follows: (l) Traverses the avenues S---,v;, A~_ t, and A~+ t through A,._ 2. Traverses all the edges on S= between A~ and A,, repeating each ABE except the corner edge (vz, c3). On S,, between Ai and A._ t, each ABE is traversed but no RBE is. Also, the edges (vt, vi) and (v;, v6), both of which are ABE, are traversed. (2) Traverses the solid lines of the network. Now the ABE (v2, v3) is repeated. (The p o s t m a n then never returns to the boundary St between A~ and A,,.) (3) Traverses the streets S~ through S,.-2. Traverses each RBE and repeats every ABE on.A., including the two corner edges which were traversed by (2). Traverses each ABE but no RBE on AI between Sz and S . _ t- (The postman then never returns to A..)
As a result, every ABE in the network is repeated exactly once and no other edge is repeated. By Remark 2, it is then easy to see that the postman's route is optimal. Finally, we note that for some alternating U N the above subroutes are traveled in different sequences. For example, the network of Fig. 2 with all edge directions reversed or with S on a boundary is such a network. In other network structures, one or more of the subroutes may be omitted or truncated. An example is a network with a small n u m b e r of streets or avenues, say m = 4 or n = 4, or both. In either case, our arguments on repeated ABE hold. Thus, the algorithm always yields an optimal route. ANOTHER ALGORITHM
(6) Traverses each RBE and repeats each ABE on A t (also see (2) and (3)). ( T h e n - t h e p o s t m a n never returns to At.)
In Fig. l, we note that the directions around certain four-edged regions are consistent, either clockwise or counterclockwise. Figure 3 shows such consistency in arrows. Moreover, observe that the consistent directions alternate diagonally. We shall develop another algorithm based on these observations. A series of subroutes, each beginning and ending at a (+1 vertex, will constitute the postman's route. A subroute covers diagonally a certain n u m b e r of the four-edged regions with consistent directions. We envisage each such subroute consisting of two "trips'; one to cover only two adjacent sides of each region in a zig-zag fashion and the other (return trip) to cover the. remaining two sides in a zig-zag fashion. Let S be the starting point. For simplicity of exposition, we take a boundary point for S. The algorithm proceeds as follows:
(7) Traverses each RBE and repeats each ABE on St between A t and Ai (also see (l), (2), and (5)), and then the last leg v ~ S , returning to the starting point. (The p o s t m a n never returns to Sz.)
(I) Proceed along the boundaries and enter the U N via the first ( - ) vertex leading to an untraversed interior block. If S is reached before such a vertex and the entire network is traversed, stop.
(4) Traverses each RBE and repeats each ABE on S , between A, and Ai (also see (I) and (2)). (5) Traverses Ai_ 2, A~-3 . . . . . A3. Traverses each RBE and repeats each ABE on S,. between A~ and A t (also see (1) and (2)). Traverses each ABE but not RBE on St between Az and A~-z. (After (4) and (5), the postman never returns to S,,.)
Omega, Vol. I0, No. 3
C-)
S~
(+]
(-)
337
C+)
C-]
(+)
57
i
36
(+1
t-I
29
(-)
54 i
43
35
)
"
30
16
'54
31
19
23 2 ~,
ag~
S
4g
7
32
(+)
(-}
~""-"""'-'--~
6
- ,5
20
gi I
41
33 ~ - ' - " " " ' ¢ ~
"~"-'--- "'~-" 1 5
55'(_}
47 48
,,, 39
17 t8
56
50
44
42 (+)
~8
fl
~2-
(+)
q 2:2 25,
14
2, l
4
31
10
,15
26
t+)
t-)
(+)
(-)
{+l
C-)
FIG. 3. Another postman route. (2) Proceed s t r a i g h t two b l o c k s if b o t h are untraversed. O t h e r w i s e , or if a return trip is necessary, proceed one block. If a return trip is necessary, go to (31. O t h e r w i s e , m a k e a turn and repeat this step.
2. EDMONDS J & JOHNSON EL (1973) M a t c h i n g , Euler tours, a n d the Chinese p o s t m a n . Math. Program. 5, 88-124. • 3. MINIEKA E (1979) The Chinese p o s t m a n p r o b l e m for m i x e d networks. Mgmt Sci. 25, 643-648.
(3) M a k e the return trip. G o to (1). A p p l y i n g this a l g o r i t h m to the n e t w o r k in Fig. 3, with S on As, we o b t a i n a n o t h e r o p t i m a l p o s t m a n route indicated by a sequence of n u m b e r s for turning. C o m p a r e d with the earlier route, this r o u t e a p p e a r s less practical for i m p l e m e n t a t i o n because of the zig-zag movements. REFERENCES I. CHRISTOFIDES N
graph. Omega
(1973) T h e
o p t i m u m traversal o f a
I (6), 719-732.
ID M o o n (April; revised version October 1981) Department of Industrial Enyineering and Operations Research Columbia University N Y 10027 USA