European Journal of Operational Research 155 (2004) 44–50 www.elsevier.com/locate/dsw
Discrete Optimization
Solving the hierarchical Chinese postman problem as a rural postman problem Edgar Alberto Cabral a, Michel Gendreau b, Gianpaolo Ghiani c, Gilbert Laporte d,* a
Faculty of Business, University of Alberta, Edmonton, Canada T6G 2R6 CRT and DIRO, Universit e de Montr eal, C.P. 6128, Succursale ‘‘Centre-ville’’, Montr eal, Canada H3C 3J7 c Dipartimento di Ingegneria dellÕInnovazione, Edificio ‘‘La Stecca’’, Via per Arnesano, 73100 Lecce, Italy d GERAD and Canada Research Chair in Distribution Management, Ecole des Hautes Etudes Commerciales, 3000 chemin de la C^ ote-Sainte-Catherine, Montr eal, Quebec, Canada H3T 2A7
b
Received 16 January 2002; accepted 19 September 2002
Abstract In the undirected hierarchical Chinese postman problem (HCPP), the edges of a graph are partitioned into clusters and must be serviced while respecting a hierarchy, or precedence relation, between clusters. Two objectives are considered: a hierarchical objective and a makespan objective. In this article, a transformation of the HCPP into an equivalent rural postman problem (RPP) is presented. The HCPP is solved optimally, for both objectives, by applying an exact branch-and-cut RPP algorithm to the transformed problem. Two heuristics based on the RPP algorithm are also described and assessed computationally. Ó 2003 Elsevier B.V. All rights reserved. Keywords: Parallel computing; Metaheuristics; Routing; Real-time
1. Introduction The hierarchical Chinese postman problem (HCPP) is defined on a graph whose edges or arcs are partitioned into clusters which induce a service hierarchy, i.e., all arcs or edges of cluster Eh must be serviced before those of cluster Ehþ1 . For simplicity, this article is restricted to undirected graphs, but its main ideas extend mutatis mutandis
*
Corresponding author. Tel.: +1-514-343-6143; fax: +1-514343-7121. E-mail address:
[email protected] (G. Laporte).
to directed or mixed graphs. Formally, the HCPP is defined on an undirected graph G ¼ ðV ; EÞ, where V ¼ fv0 ; v1 ; . . . ; vn g, v0 is a depot and E ¼ fðvi ; vj Þ : vi ; vj 2 V ; i < jg is an edge set partitioned into fE1 ; . . . ; Ep g. It is convenient to also denote an edge by e. The cluster index of edge e is denoted by aðeÞ. With each edge e 2 E are associated three lengths or traversal times: te3 is the time of servicing edge e (e.g., removing snow on edge e); te2 is the traversal time of e if it has not yet been serviced; te1 is the traversal time of e if it has already been serviced. Typically, te3 P te2 P te1 :
0377-2217/$ - see front matter Ó 2003 Elsevier B.V. All rights reserved. doi:10.1016/S0377-2217(02)00813-5
ð1Þ
E.A. Cabral et al. / European Journal of Operational Research 155 (2004) 44–50
For example, in snow removal operations, the longest operation consists of removing snow on an edge, followed by traversing an unserviced edge, followed by traversing a serviced edge. However, there exists situations where te2 P te3 (typically te2 ¼ 1) if, for example, traversing an unserviced edge is extremely difficult or impossible. Our model can easily handle both situations but feasibility is not guaranteed in the second case. In what follows, we assume that (1) holds. Let T h be the shortest time required to service all edges of E1 [ [ Eh ðh ¼ 1; . . . ; pÞ by using a single vehicle based at the depot, and let T pþ1 be the time required to return to the depot, i.e., T pþ1 is equal to T p plus the shortest travel time to the depot from the last serviced edge. The HCPP consists of designing a traversal of all edges of E, starting and ending at the depot, in such a way that the service hierarchy is satisfied and a time objective is minimized. Two natural objectives can be considered: (1) the makespan objective equal to T pþ1 ; (2) the hierarchical objective equal to M1 T 1 þ þ Mp T p , where M1 M2 Mp ¼ 1. The notation ‘‘’’ means that in any feasible solution the relation Mh T h >
p X
Mk T k
ð2Þ
k¼hþ1
must be satisfied for h ¼ 1; . . . ; p 1. Relation (2) holds if T h is replaced by a lower bound and each T k is replaced by an upper bound. The makespan objective is the most commonly used, see, e.g., [1,4,9,13]. The hierarchical objective makes sense in contexts where streets with different priority levels must be serviced and it is crucial to service all edges having a given priority before proceeding to other edges. In such a context, the emphasis is placed on service completion as opposed to the time at which the vehicle returns to the depot. To our knowledge, the hierarchical objective has never previously been considered in the scientific literature. The graph shown in Fig. 1 illustrates the difference between the two objectives. The service hierarchy of each edge e is given, followed in parentheses by the vector ðte1 ; te2 ; te3 Þ. The hierarchical optimal solution is (0, 1, 2, 1, 3, 2, 1, 3, 0) and yields T 1 ¼ 17 and T h ¼ 40; the makespan optimal
45
1 ,
1
2 (1,
1(
4)
1,
2,
4)
1 (2, 4, 8)
0 2(
5,
7,
2 0)
,1
10
)
2
7 (5,
3 Fig. 1. Graph illustrating the difference between the hierarchical and the makespan versions of the HCPP.
solution is (0, 1, 3, 1, 2, 3, 0) and yields T 1 ¼ 18 and T h ¼ 38. Applications of the HCPP or of related problems arise naturally in snow plowing and street maintenance operations [1,2,5–7,11,13] where the hierarchical objective is appropriate, and in flame cutting [14] where the makespan objective is used. Some of these applications differ slightly from our definition of the HCPP. In some cases a deadline Dh is imposed on the completion of service for all edges of Eh . The HCPP is NP-hard [4], but can be solved in polynomial time if the service hierarchy can be described by a linear precedence relation between clusters and each cluster Ek is connected. Dror, Stern and Trudeau [4] have provided an Oðpn5 Þ time algorithm for this case while Ghiani and Improta [9] have described an improved Oðp3 n3 Þ time algorithm for the same problem. Gelinas [8] has devised a dynamic programming algorithm for the directed HCPP with specified starting and ending vertices in which each cluster is strongly connected. Our purpose is to show how the HCPP with linear precedence relations (but with no assumption on cluster connectivity) can be cast as a rural postman problem (RPP) by defining a suitable graph transformation. Recall that in the RPP, the edge set is partitioned into required and nonrequired edges. The aim is to determine a least cost traversal of all required edges. The interest of this transformation is that relatively fast exact and heuristic algorithms already exist for the RPP (see, e.g., [10] for an exact algorithm, and [12] for heuristics) and can thus be used directly for the
46
E.A. Cabral et al. / European Journal of Operational Research 155 (2004) 44–50
(
HCPP. To our knowledge, this constitutes the only available solution procedure for the HCPP and, as our results show, it can be applied to solve medium size instances optimally. We will start by describing, in Section 2, the transformation for the hierarchical objective and its adaptation to the makespan objective. Computational results will be presented in Section 3.
h te
¼
te1 te2
if aðeÞ 6 h if aðeÞ > h
for e 2 E and h 2 f1; . . . ; pg, and let shij be the length of a shortest path between vertices vi and h vj with respect to the modified edge lengths te . The transformation operates on a ðp þ 2Þ-layered multigraph H ¼ ðVH ; EH Þ. The vertices of H are defined as follows. Layers 0 and p þ 1 each contain a copy of v0 . Layer h ðh 2 f1; . . . ; pgÞ contains the vertices of V h . In the HCPP with hierarchical objectives, the edges of H and their cost are defined as follows. For any two vertices vi and vj belonging to the same layer h ðh 2 f1; . . . ; pgÞ, Ph h define a non-required edge of length k¼1 Mk sij ;
2. Transformations into rural postman problems Some additional notation is required to describe the transformation. Let V h ¼ fvi 2 V : vi is incident to at least an edge of Eh g. Also define the modified edge lengths
1 1 0
2
3 2
1 2
(a)
0
h=0
ð3Þ
0
1
1
2
2
3
h=1
h=2
required edge,
0
h=3
non-required edge
(b) Fig. 2. Transformation of the HCPP into an RPP: (a) graph G showing service hierarchies and (b) transformed graph H .
E.A. Cabral et al. / European Journal of Operational Research 155 (2004) 44–50
in addition, if e ¼ ðvi ; vj Þ 2 Eh , also define a Ph 3 required edge of length M k te between vi k¼1 and vj . Similarly, for any two vertices vi and vj belonging to two successive layers h 1 and h ðh 2 f1; . . ; pgÞ, hdefine a non-required edge of length P.h1 M k sij þ M, where M M1 . Finally, define k¼1 a non-required edge of length M between the vertices of V p and the unique vertex of layer p þ 1, as well as a required edge of cost 0 linking the two copies of the depot (see Fig. 2). Proposition 1. An optimal solution to the RPP on H yields an optimal solution to the HCPP with hierarchical or makespan objective on G. Proof. We first show that an optimal RPP solution of cost z on H corresponds to an optimal hierarchical HCPP solution of cost z ðp þ 1ÞM on G. First, observe that every edge in G is required in H , so that any HCPP solution on G has its counterpart in H . Moreover, the RPP solution in H will respect the service hierarchy since the constant M in the inter-layer edge costs guarantees that in the RPP solution, all edges of the same layer are visited contiguously. The solution cost is correctly calculated. Indeed, every edge e 2 Eh will be traversed in time te3 as a required edge Ph of layer h in H , and this cost will be counted k¼1 Mk times in the hierarchical objective. Any other traversal of h e in the solution will be carried out in time te , equal 1 2 to te or te , depending on whether the edge is traversed before the completion of layer h, or after. As in the RPP, no edge is traversed more than twice in an optimal solution and, if an edge is traversed twice, the optimality of the RPP solution on H ensures that service is performed during the first traversal. This transformation can easily be adapted to the makespan objective. The intra-layer edge costs are then simply defined as shij for non-required edges, and as te3 for required edges ðh 2 f1; . . . ; pgÞ. The edges between layers h 1 and h now have a cost equal to shij þ Mðh 2 f1; . . . ; p þ 1gÞ. The above argument can easily be transformed to show that the HCCP with makespan objective can also be solved as an RPP.
47
3. Computational results To validate the computational value of the proposed transformations, we have solved a problem defined on a real-world graph as well as several randomly generated instances using the RPP branch-and-cut exact algorithm developed by Ghiani and Laporte [10]. All instances were solved on a PC with a Pentium processor at 300 MHz with 64 MBytes of RAM. A maximum running time of 5000 seconds was imposed for each instance. The real-world graph is the Albaida1 graph of Corberan and Sanchis [3] which contains 113 vertices and 171 edges. The edges e ¼ ðvi ; vj Þ of his graph were partitioned into three classes of service hierarchy by defining aðeÞ ¼ 1 þ ði þ jÞ ðmod 3Þ. We also produced random graphs as in [12] by first generating n ¼ jV j vertices in the plane, and linking them by means of Hamiltonian cycles without creating the same edge twice. Service hierarchies were defined as for the Albaida1 graph. Five instances were generated for each graph size. Test data are available from the third author. We report average statistics over the number of instances that could be solved optimally within the prescribed time limit. The table headings are as follows: n ¼ jV j jVH j Succ Th
number of vertices in G number of vertices in H number of successful instances out of 5 time required to service all edges of E1 [ [ Eh ðh ¼ 1; 2; 3Þ; this time is optimal if the hierarchical objective is used T4 time required to service all edges and return to the depot; this time is optimal if the makespan objective is used Nodes number of nodes in the branch-and-cut tree Seconds number of CPU seconds We were unable to solve the Albaida1 problem within the prescribed time limit using the hierarchical objective. The same problem was easily solved for the makespan objective in 342 seconds, after 633 nodes. The other statistics are as follows: jVH j ¼ 248, T 1 ¼ 25,222, T 2 ¼ 43,443, T 3 ¼ 62,713, and T 4 ¼ 62,965.
48
E.A. Cabral et al. / European Journal of Operational Research 155 (2004) 44–50
Exact solution results for randomly generated instances are presented in Tables 1 and 2 for the makespan and the hierarchical objective, respectively. The largest instances solved contain 150 vertices in the first case and 50 vertices in the second case. As often happens in integer programming, the RPP branch-and-cut has difficulty handling the large constants in the hierarchical objective. Since solving the HCPP with hierarchical objective quickly becomes time consuming as n grows, we have devised two simple heuristics that make use of the transformation into an RPP. The first, called decomposition heuristic, works by iteratively applying the following operations for h ¼ 1; . . . ; p: using the RPP transformation, solve the HCPP on the subgraph induced by the edges of Sh k k¼1 E and declare all traversed edges already serviced. The second heuristic, called makespan heuristic, consists of using the optimal solution to the HCPP with makespan objective as a feasible solution to the HCPP with hierarchical objective. The rationale
behind this heuristic is that the makespan HCPP is much easier to solve than the HCPP with hierarchical objective, and solution values obtained with the two objectives may not differ very much. Computational results for these heuristics are presented in Tables 3 and 4. The column headings not yet defined are: gaph : 100 (value of T h produced by the heuristic divided by the optimal value of T h produced by the exact algorithm with the hierarchical objective, minus one). For the Albaida1 problem, the decomposition heuristic produced the following solution after 11 seconds and 111 branching nodes: T 1 ¼ 25,222, T 2 ¼ 43,311, T 3 ¼ 62,547, and T 4 ¼ 64,277. Computational results for the decomposition heuristic on the randomly generated instances are presented in Table 3 for sizes up to jV j ¼ 300. For this heuristic all optimality gaps were equal to zero for jV j 6 50. Finally, the percentage gaps shown in Table 4 indicate that using the makespan objective
Table 1 Exact algorithm (makespan objective) jV j
jVH j
Succ
T1
T2
T3
T4
Nodes
Seconds
30 40 50 60 70 80 90 100 110 120 130 140 150
80 106 144 171 194 230 248 280 310 338 362 393 438
5 5 5 5 5 5 4 4 5 5 5 5 2
23,947 28,572 52,952 61,854 71,144 58,882 72,910 66,180 80,196 99,659 77,876 102,563 206,807
48,986 56,948 104,388 128,955 134,222 117,173 134,697 132,271 165,410 200,817 154,638 205,038 418,869
71,342 82,533 157,889 191,317 208,022 178,606 198,213 197,249 248,162 297,510 224,650 305,224 609,831
71,342 82,533 157,889 191,317 208,022 178,606 198,237 197,268 248,162 297,528 224,650 305,234 609,831
6 4 3 7 6 12 58 35 15 6 26 7 2
2 3 6 15 21 56 199 196 173 259 430 546 833
Table 2 Exact algorithm (hierarchical objective) jV j
jVH j
Succ
T1
T2
T3
T4
Nodes
Seconds
30 40 50
80 106 144
5 5 3
23,766 28,423 42,883
48,671 56,952 86,687
70,982 82,532 128,188
71,938 83,347 129,342
3 13 106
3 40 319
E.A. Cabral et al. / European Journal of Operational Research 155 (2004) 44–50
49
Table 3 Decomposition heuristic jV j
Succ
T1
T2
T3
T4
Nodes
Seconds
30 40 50 60 70 80 90 100 110 120 130 140 150 200 250 300
5 5 5 5 5 5 5 5 5 3 5 3 5 4 4 5
23,766 28,423 42,883 61,736 71,057 52,668 71,320 61,497 80,043 119,966 77,816 170,526 127,770 112,976 104,742 107,353
48,671 56,952 86,687 128,937 134,167 106,863 137,276 125,084 165,333 241,545 154,620 368,941 255,516 226,113 201,940 215,488
70,982 82,532 128,188 191,201 207,744 162,416 203,014 187,767 248,006 361,055 224,380 559,318 374,318 332,454 306,606 319,166
71,938 83,347 129,342 191,948 208,633 163,018 203,890 188,622 248,579 361,894 225,470 560,139 374,924 332,811 307,584 320,025
5 3 4 3 14 5 4 6 6 8 7 5 13 15 15 37
1 1 1 1 2 1 4 6 9 13 15 25 27 94 225 532
Table 4 Percentage gaps: Makespan heuristic vs. hierarchical exact algorithm jV j
Succ
gap1
gap2
gap3
gap4
30 40 50
5 5 3
0.8 0.5 0.3
0.6 0.0 0.0
0.5 0.0 0.2
)0.8 )1.0 )0.7
or the hierarchical objective does not make much difference as far as the objective function is concerned (some values are negative because the hierarchical exact solution value is sometimes larger than the solution value produced by the makespan heuristic). In practice, the makespan objective can be employed if an optimal solution is sought. Otherwise, the decomposition heuristic is an excellent alternative.
Acknowledgements This research was partly supported by the Canadian Natural Sciences and Engineering Research Council (grants OGP0038816 and OGP0039682), by the Canadian International Development Agency, by the Ministero della Ricerca Scientifica e Tecnologia (MURST) and by the Consiglio Nazionale delle Ricerche (CNR), Italy. This support is gratefully acknowledged. Thanks are due to the referees for their valuable comments.
References [1] A.S. Alfa, D.Q. Liu, Postman routing problem in a hierarchical network, Engineering Optimization 14 (1988) 127–138. [2] L.D. Bodin, S.J. Kursh, A detailed description of a computer system for the routing and scheduling of street sweepers, Computers & Operations Research 6 (1979) 181–198. [3] A. Corberan, J.M. Sanchis, A polyhedral approach to the rural postman problem, European Journal of Operational Research 79 (1994) 95–114. [4] M. Dror, H. Stern, P. Trudeau, Postman tour on a graph with precedence relations on arcs, Networks 17 (1987) 283–294. [5] R.W. Eglese, Routing winter gritting vehicles, Discrete Applied Mathematics 48 (1994) 231–244. [6] R.W. Eglese, L.Y.O. Li, Efficient routing for winter gritting, Journal of the Operational Research Society 43 (1992) 1031–1034. [7] R.W. Eglese, H. Murdock, Routing road sweepers in a rural area, Journal of the Operational Research Society 42 (1991) 281–288. . Gelinas, Le probleme du postier chinois avec contraintes [8] E cole Polygenerales de preseance, M.Sc.A. Dissertation, E technique de Montreal, Canada, 1992.
50
E.A. Cabral et al. / European Journal of Operational Research 155 (2004) 44–50
[9] G. Ghiani, G. Improta, An algorithm for the hierarchical Chinese postman problem, Operations Research Letters 26 (2000) 27–32. [10] G. Ghiani, G. Laporte, A branch-and-cut algorithm for the undirected rural postman problem, Mathematical Programming 87 (2000) 467–481. [11] E. Haslam, J.R. Wright, Application of routing technologies to rural snow and ice control, Transportation Research Records 1304 (1991) 202–211.
[12] A. Hertz, G. Laporte, P. Nanchen-Hugo, Improvement procedures for the undirected rural postman problem, INFORMS Journal on Computing 11 (1999) 53–62. [13] P.F. Lemieux, L. Campagna, The snow ploughing problem solved by a graph theory algorithm, Civil Engineering Systems 1 (1984) 337–341. [14] U. Manber, S. Israni, Pierce point minimization and optimal torch path determination in flame cutting, Journal of Manufacturing Systems 3 (1984) 81–84.