Transformation of the Mixed Chinese Postman Problem in multigraph into the Asymmetric Travelling Salesman Problem
Maria K. Gordenko, Sergey M. Avdoshin
Abstract— The Mixed Chinese Postman Problem (MCPP) is to find a minimum shortest tour of given graph or multigraph traversed each edge or arc at least once. The problem is NP-hard. However, mixed case of the problem has many potentially useful applications, including delivering of something, robot exploration, web site usability, etc. In this article, we propose to solve the problem using the graph transformation and solving well-known Asymmetric Travelling Salesman Problem (ATSP). The algorithm for transforming the MCPP in multigraph into ATSP is pointed out.
Keywords— Mixed Chinese Postman Problem, Arc Routing Problem, graph transformation, Traveling Salesman Problem.
I. Introduction
In the Mixed Chinese Postman Problem in multigraph, we a given a set of vertices (cities) and arcs and edges, that connect the vertices and define non-negative costs between them. The problem was originally studied by the Chinese mathematician Kwan Mei-Ko in 1962 [1]. A problem is called the Chinese Postman Problem (CPP) after him [2].
Apart from the traditional application of the CPP to solving the routing problems such as path planning of snowplows or serving teams, there is a wide range of applications including robot exploration, testing web site usability and finding broken links [3].
There are many various classifications of CPP. Let is consider some of them.
A. Classification based on graph type
Depending on the graph type, the CPP can be following: • Undirected Chinese Postman Problem (UCPP, UPP). The problem is defined on undirected graph G =< V, E, C >, where V is the set of vertices, E is the set of edges, C: E ^ R+ - cost function giving non-negative weights of arcs and edges between vertices. Each edge can be traversed in both directions. The problem can be solved exactly in polynomial time. Notice that between two vertices can be defined more than one edge. In this case, the
Manuscript received April 20, 2017.
Maria K. Gordenko is with the Department of Software Engineering, Faculty of Computer Science, National Research University Higher School of Economics, Moscow, Russia ([email protected]).
Sergey M. Avdoshin is is with the Department of Software Engineering, Faculty of Computer Science, National Research University Higher School of Economics, Moscow, Russia ([email protected]).
multigraph
G = < V, E, C > is given, where V is the set of multigraph's vertices, E is the multiset of edges [4].
• Directed Chinese Postman Problem (DCPP, DPP). In this case, the directed graph G =< V, A, C > is given, where E is the set of edges. Each arc has a direction and can be traversed in one way. The problem also may be determined on multigraph, where between a single pair of vertices can be more than one arc. The exact polynomial solution was provided [3].
• Mixed Chinese Postman Problem (MCPP, MPP). The initial graph G = < V, E U A, C > consists of directed and undirected edges, simultaneously [5].
The MCPP is a simply-stated problem, which has many potentiallyvuseful applications, however, has no exact algorithms [6].
B. Classification based on tour type
According to type of tour, the CPP can be following:
• Closed CPP. The solution tour should be closed (start and end vertex are equal). It means that postman should beginning and ending at the same point [3].
• Open CPP. The postman should not return to the starting point [3].
C. Classification associated with arcs and edges
There are many modifications of CPP based on arcs and/or edges' parameters variation. Below some of them are presented.
• Windy Chinese Postman Problem. The cost between to vertices vt and Vj depends on traverse direction (Cij * cji) [7].
• Rural Chinese Postman Problem. The set of edges E in undirected graph, the set of arcs A in directed graph or the set \AUE\ in mixed graph consists from two subsets: required and non-required. Required arcs/edges should appear in solution at least once, non-required edges can absent in tour solution [8].
• The Hierarchical Postman Problem. The set of edges E in undirected graph, the set of arcs A in directed graph or the set \A U E\ in mixed graph partitioned into clusters and on each clusters the priority of the traversing is determined [9].
Above the main classifications and typical representatives of the problem are represented. However, the list of variations of the problem is not exhaustive.
In this paper, we are talking about the MCPP in multigraph. Despite the fact that the problem has many applications, there is no exact solution. There are many
heuristic algorithms for solving the problem in a mixed graph [6]. However, it was not possible to find an algorithm for solving the problem in a mixed multigraph. To obtain a solution in the mixed multigraph, the methods of transforming the problem into equivalent arc routing problem Asymmetric Travelling Salesman Problem (ATSP) throw the transformation of initial problem into the Asymmetric Generalized Travelling Salesman Problem (GTSP) were examined [10-12].
The paper is organized as follows. First, the mathematical formulation of the problem is pointed out. The next section is dedicated to related works. In the following parts the description of implemented algorithm and methods of the research are presented. Then already obtained results are revealed. In the final part, the future directions of research are described.
II. Mathematical formulation of the MCPP
The weight strongly connected mixed multigraph G = < V, E U A, C > is given, where V is the set of multigraph's vertices, E is the multiset of edges, A is the multiset of arcs, C: E U A ^ R+- cost function giving nonnegative weights of arcs and edges between vertices [6].
Let I = {1,2,..., \E + A\}, L = {1,2,..., \V\}.
Indexation on the set of vertices V is defined as inv. V ^ L, Vvi E V Vvj EV vi ^ Vj ^ i ^ j,
i = inv(vi). On the multiset E U A indexation is defined as inea. E U A ^1, Vet E (E U A) Vej E (E U A) ei ^ ej ^ i ± j, i = inea(ej).
V = (evi, eP2.....ePk) (1)
Route (1) is a solution of the MCPP that satisfies the following properties.
• v-iePl) = v+(ePk),
Vi E {1,2,...,k - 1} v+^ep.) = v-(ep.+i), where v-(e) is the start vertex of arc or edge e, v+(e) is the end vertices of arc or edge e.
• E U A\ {epi, ep2.....epk} = 0.
Let C(p) = Y,C=i C(ei) is the cost of the route.
Let M be a set of solutions of the MCPP. It is necessary to find a route n0 E M that satisfies the following property V^EM C(^0) < C(ji) or C(^0) = min^EM( C(M)).
III. Related works
Number of articles and the research on the CPP issue have been found.
The most popular classifications and variations of the CPP was found in the paper by D. Mohammaditabar [10].
The mathematical formulations of problems can be found in the Optimization and Operation Research book. It shows that the UCPP and DCPP has exact solution and can be solved in polynomial time. The MCPP is NP-hard [11].
In the work of Harold Thimbleby from University College London, the polynomial algorithm and executable code on Java for DCPP in multigraph were represented. The article reveals possible applications CPP. Great attention is paid to the application of the solution of the problem to testing web-site, broken links and etc. [3].
In many researches, the algorithm for solving UCPP is presented. The algorithm is based on making the Eulerian graph and finding the Eulerian cycle in it.
In the paper by G. Laporte the exact algorithm for an undirected and directed graph is covered and the formulation of the problem in the mixed graph is shown [12]. The T. Ralph's paper contains formulation of CPP on the mixed graph in terms of integer linear programming [6].
For the Mixed case, the many heuristics are existed. However, for the MCPP in multigraph finding the algorithms description was failed [6].
It was shown that several arc routing problems (ARP) can be converted into equivalent ARP. It opens the possibility to solve ARP, including the MCPP, as equivalent of another arc routing problem [11-13].
The paper gives grounds to assume the MCPP can be converted into Asymmetric Travelling Salesman Problem (ATSP).
IV. transformation the MCPP into asymmetric GTSP
The MCPP can be transforms into an equivalent arc routing problem. when problem defined in directed multigraph (DCPP), it can be transformed into ATSP. When problem defined in mixed or undirected multigraph, it can be at first transformed into an asymmetric GTSP, and after that into ATSP [11-12]. The proof of correctness of this algorithm was given by M. Blais [13].
A. Description of transformation algorithm
The process of transformation the MCPP to GTSP is to transform the original graph G =< V, E U A, C > into equivalent problem on complete graph G =< V, A, C >.
Each arc ai E A between to vertices vi, vj E V is represented as vertex vi E V, which must be used in the solution at least once, where k is the serial number of parallel arc.
Each edge ei E E between to vi, vj EV is represented as
two vertices vf',1, vi2 E V, one of which must be used in the
ij ij
solution, another may not be used, where k is a serial number of parallel edge, ki, k2 are the serial numbers of parallel arcs between two vertices.
After replacing the arcs and edges in vertices, the cost from each pair of vertex va1, vc2 EV in graph G compute, as
c~ = dbc + cCI (2)
where dbc is the shortest distance between vertices vb, vc E V in original multigraph G.
Then, the compete graph G is partitioned into clusters as follows: each arc and each edge is separate clusters. The number of clusters is equals to \^U£\. The graph partitioned into clusters because edge can be traverse in two ways, for solving the MCPP any way is appropriate and the problem transforms into asymmetric GTSP [13].
The GTSP is a variation of the Traveling Salesman Problem in which all vertices are divided into clusters, and solution consist from one vertices from each cluster.
TABLE I. Formulas for computing arc costs of Asymmetric GTSP
1 2 3 4 5 6 7 8
Vl2 vis vis "21 vh vk vh V32
1 ^2 - S21 + C13 S21 + C13 S22 + C21 s22 + C23 s22 + C23 s23 + C31 s23 + C32.
2 vh S31 + C\_2 - S31 + C13 s32 + C21 S32 + C2.3 S32 + C23 S33 + C31 S33 + C32.
3 vfi S31 + C12. S31 + C13 - S32 + C21 s32 + C23 s32 + C23 s33 + C31 s33 + C32.
4 V71 S11 + C12. S11 + C13 S11 + C13 - s12 + C23 S12 + C23 s13 + C31 S13 + C32.
5 V73 S31 + C12 S31 + C13 S31 + C13 s32 + C2t - S32 + C23 S33 + C31 S33 + C32.
6 S31 + C12. S31 + C13 S31 + C13 S32 + C21 s32 + C2.3 - s33 + C31 s33 + C32.
7 vh S11 + C12 S11 + C13 S11 + C13 s12 + C21 S12 + C23 S12 + C2.3 - S13 + C32.
8 v3i S21 + C12 S21 + C13 S21 + C13 s22 + C21 S22 + C23 S22 + C23 S23 + C31 -
B. The example of transformation The example of original multigraph is shown on Fig. 1. Each arc and edge has the cost of traverse. Each vertex has a serial number.
TABLE II.
The cost matrix
1 2 3 4 5 6 7 8
vh VI3 Vv3 ^21 Vt.3 vh
1 ^2 - 6 7 1 2 3 6 5
2 5 - 10 4 5 6 4 3
3 V13 5 9 - 4 5 6 4 3
4 1 5 6 - 3 4 7 6
5 V$3 5 9 10 4 - 6 4 3
6 V?3 5 9 10 4 5 - 4 3
7 V1! 1 5 6 2 3 4 - 6
8 V32, 2 6 7 1 2 3 6 -
Then verteces from V are partitioned into clusters. Fig. 3 depicts the vertices and clusters of transformed graph.
Fig. 1. The original MCPP problem in multigraph
We replace each edge by a pair of two oppositely directed arcs and specify the numbering of parallel arcs between each pair of vertices (see Fig. 2). In multigraph only one arc a\2 or a21 is required, because these arcs represent one edge. The same applies to arc a|3 or a\2 •
Fig. 2. The results of numbering each parallel arc
After that, should replace each arc and edge as vertex. We received new graph G with 8 verteces. The V can be calculates as formula:
№ \ = \A\+2\E \ (3)
The cost from each pair of vertices is calculated by formulas (see Table 1, see Table 2). The vertices represent the edge are marked with a color in the table (different colors for different edges).
Fig. 3. The vertices and clusters of transformed problems
The transformation of the MCPP into Asymmetric GTSP is received. After transformation of the original MCPP into the GTSP, the existing algorithm for GTSP can be applied. However, we try to transform received Asymmetric GTSP into ATSP.
V. Transformation the Asymmetric GTSP into ATSP
The Asymmetric GTSP can be transformed into ATSP with the same number of vertices. Proof that the algorithm is applicable to any GTSP is given in the paper by G. Laporte [13]. Below the description of transformation algorithm is described [12, 16].
A. Description of transformation algorithm The steps of transformation:
• Define the set of vertices V, which is equal V.
• Within each cluster, set the cost of the arcs between each pair of vertices in the cluster equal to 0. cC = 0,
where i, j - the number of vertices belonging to the clusters.
• If two vertices vt, vj 6 V are in different clusters, the cost calculate as:
T = Cij (4)
where vt is another vertex from cluster with vt.
The based idea of this transformation that salesman, firstly visit all vertices into clusters and then go into another cluster. The GTSP tour can be easily find from TSP tour, by extracting first vertex from each cluster from TSP tour [14].
B. The example of transformation Define the auxiliary tables.
Table 3 shows the distribution of vertices over clusters. While Table 4 shows the distribution of clusters over vertices.
TABLE III. The clusters
Cl V
1
2 VÏ-3
3 Vvs
4
5 V23; V12
6
TABLE IV. The vertices into clusters
N 1 2 3 4 5 6 7 8
V vb vl-3 vfi v2l v\i V12
Cl 1 2 3 1 4 5 6 5
Table 5 shows the cost matrix of equivalent ATSP. Costs were calculated in accordance with subsection A.
VI. Methods of testing
The code for graph transformations was written on C++ in MS Visual Studio 2015. For solving ATSP the library LKH by Keld Helsdgaun was used as a black box [17].
To test all algorithms, two test databases were used. For multigraph, the test data sets were not found. However, graph is a special case of multigraph (without parallel arcs and edges) and algorithm can be tested on graph data sets. In Bonisch's database the input data for 50, 100, 200 vertices in graph are presented. For each dimension, there is 25 different tasks. In Corberan's database the input data for 500, 1000, 1500, 2000, 3000 vertices in graph are presented. For each dimension, there is 24 different tasks. [15, 16].
The time performance of the two transformations (the
MCCP into GTSP, the GTSP into ATSP) were measured as follows:
• Test data were loaded in console program;
• The measurements for each input data set were carried out 10 times. The results of computational time were obtained as the average of 10 runs of the program:
At first, the MCPP was transformed into the GTSP, then the GTSP was converted into ATSP.
The error and time performance of the LKH [16, 17] algorithm was measured on the converted data, as follows:
• Test converted data of ATSP were loaded in console program;
• The measurements for each input data set were carried out 10 times. The results of time performance were obtained as the average of 10 runs of the program (according to the formula (5));
• Error rate of the algorithms was evaluated according to the formula:
Error = CJtt«!!*L (6)
where C(^) is the resulting length of the route of the MCPP, C(^0) is the optimum length of the route of the MCPP given in input data.
All test provides on Mac Book Pro 13 retina 2014 (Intel Core i5, 2.6 GHz).
VII. Obtained results
The test results are divided into three subsections. At first, the time performance of the MCPP into the GTSP transformation was received. Second, the testing of transformation the GTSP into ATSP was conducted. Finally, the LKH [18, 19] algorithm was applied to the transformed data and its time performance and error rate were measured.
A. Results of testing transformation the MCPP into the GTSP
The time performance of algorithm's work most depends on number of vertex | in transformed problems. The graphic for |7| = 500 is presented on Fig.4. The results for all test data are presented in Table 6.
JVj-500
H IV m in « H tj T o f. U-, ro HT, .-.J in 0". *T CT' TO
Qis.jp.
r-j rv m rn 5J IJ il un ID IB y IB ffi m rji p o ri rg rj ID
I-VI
Fig. 4. The time performance of transforming the MCPP into the GTSP, |V|=500
Relatively long time of work is because that during the calculation of the transformed weights for the original matrix, it is necessary to find the matrix of shortest paths between all pairs of vertices (using the Floyd Warshall Algorithm, computational complexity - 0(V3)).
TABLE V. The ATSP cost matrix
1 2 3 4 5 6 7 8
vh v2i v2,3 v2.3 vb.
1 V\2 - 5 6 0 3 4 7 6
2 5 - 10 4 5 6 4 3
3 V23 5 9 - 4 5 6 4 3
4 v?i 0 6 7 - 2 3 6 5
5 5 9 10 4 - 6 4 3
6 2 6 7 1 2 - 6 0
7 1 5 6 2 3 4 - 6
8 V32 5 9 10 4 5 0 4 -
TABLE VI. The result of testing transforming the MCPP into the GTSP
\v\ \A\av. \E\av. \V\av Av. time, sec Time Standart Deviation
50 73 59 190 0,060 0,007
100 139 118 374 0,162 0,020
200 282 224 730 0,695 0,067
500 563 621 1804 3,380 0,432
1000 1133 1248 3628 13,956 1,323
1500 1689 1866 5421 37,620 3,766
2000 2256 2481 7218 72,198 7,540
3000 3319 3726 10770 196,126 16,769
B. Results of testing transformation the GTSP into the ATSP
The time of algorithm's work most depends on number of vertex \ V\ in transformed problems. The graphic for |7| = 500 is presented on Fig.5. The results for all test data are presented in Table 7.
|VJ=500
0J19 0..G3
aa? „ 0A&
I
H oj:3 Q..Q2
a^ii
u
□ r-i i(i n Q >- —i q gi r r^ ii rt
r-. rr. Vi ^ ^ J> lTi IP ^ g u] 17. rr. I—1 1T1 1— r-.1 r-J ■-■! L^l
—I i-frH >—' —I —I TH 1- — —I — —I >—' 1— —I — i^J r-j r-j r-fl
i
Fig. 5. The time performance of transforming the GTSP into the ATSP, |V|=500
TABLE VII. The result of testing transformin the GTSP into the ATsP
It can be seen from the table that the transformation takes place quickly.
C. Results of applying the LKH to solving the MCPP
For transforming data set the LKH was applied. We did not make out the principle of the algorithm, but applied it as a black box with standard perimetries, suggested by the author [17].
The results of average computing time and error rate is represented in Table 8. The applying algorithm for solving the McPP as ATsP throw the transformations opens many opportunities for research. As seen from Table 8, the results of such approach are good. Using confidence intervals, the accuracy of the time estimate was determined, which was at least 87%.
VIII. Conclusion
The way of solving the McPP in multigraph were proposed. Previously, the McPP were solved only in a mixed graph.
The algorithm for transforming the McPP in multigraph into an equivalent arc routing problem the GTsP, and then in the ATSP was implemented in C++ and tested.
The approach to transforming the McPP in mixed multigraph into equivalent ARP was evaluated on test data from the open databases. Testing has shown that this approach can be applied to the solve the McPP in multigraph and should be further investigated with various algorithms for solving the ATSP.
TABLE VIII. The result of testing LKH to solving the transformed MCPP
Av. time, sec Time Standart Deviation Av. error, % Error Standart Deviation
\V\=50 28,854 2,987 0,04 0,001
\V\=100 60,345 5,301 0,07 0,001
\V\=200 112,980 10,439 0,12 0,002
\V\=500 171,713 17,106 0,58 0,005
\V\=1000 500,729 62,606 0,92 0,007
\V\=1500 836,333 89,486 1,05 0,006
\V\=2000 1139,46 7 113,358 1,19 0,006
\V\=3000 2403,89 2 240,273 1,20 0,008
In our future work, we are going to fine-tune parameters of LKH methods using genetic search optimization algorithms. Further, it is possible to apply and investigated other existing algorithms for ATSP. Next, we are going to develop (prepare) test data for the mixed multigraph.
References
[1] V. Bryant and P. David, Decision Maths 1, London: Heinemann Educational Publishers, 2004.
[2] P. Vreda and P. Black, Dictionary of Algorithms and Data Structures, National Institute of Standards and Technology, 2014.
[3] H. Thimbleby, "The directed Chinese Postman Problem," Software Practice and Experience, vol. 33, no. 11, pp. 10811096, 2003.
[4] G. Laporte, "The Undirected Chinese Postman Problem," in Arc Routing, 2013, pp. 53-64.
[5] J. Edmonds and E. Johnson, "Matching, Euler tours and the Chinese postman," Mathematical Programming, vol. 5, no. 1, pp. 88-124, 1973.
[6] T. K. Ralphs, "On the Mixed Chinese Postman Problem," School of Operations Research and Industrial Engineering,, pp. 123-127, 1993.
[7] M. Guan, "On the windy postman problem," Discrete Applied Mathematics, vol. 9, pp. 41-46, September 1984.
[8] A. M. Rodrigues and J.'. S. Ferreira, "MIC'2001 - 4th Metaheuristics International Conference," in Solving the Rural Postman Problem by Memetic Algorithms, Porto, Portugal, 2001.
[9] G. Ghiani and G. Improta, "An algorithm for the hierarchical
\V\ \A\av. \E\av. \V\av Av. time, sec Time Standart Deviation
50 73 59 190 0,001 0,001
100 139 118 374 0,003 0,001
200 282 224 730 0,008 0,001
500 563 621 1804 0,039 0,001
1000 1133 1248 3628 0,176 0,021
1500 1689 1866 5421 0,905 0,097
2000 2256 2481 7218 3,617 0,411
3000 3319 3726 10770 6,086 0,703
Chinese postman problem," Operations Research Letters, no. 26, pp. 27-32, 2000.
[10] D. Mohammaditabar, "Chinese Postman Problem," pp. 224225, 2013.
[11] U. Derigs, Optimization and Operations Research, Singapore: EOLSS Publications, 2009.
[12] G. Laporte and M. Gendreau, "Arc Routing Problems, Part I: The Chinese Postman Problem," Operations Research, vol. 43, no. 2, pp. 131-242, April 1993.
[13] G. Laporte and M. Blais, "Exact Solution of the Generalized Routing Problem through Graph Transformations," Operations Research, vol. 54, no. 8, pp. 906-910, 2003.
[14] C. E. Noon and J. C. Bean, "An Efficient Transformation Of The Generalized Traveling Salesman Problem," INFOR Information Systems and Operational Research, vol. 31, no. 1, February 1993.
[15] S. Bönisch, "Implementierung der Edmonds-Johnson Heuritik für das Mixed Chinese Postman Problem," 21 December 1999. [Online]. Available: http://comopt.ifi.uni-heidelberg.de/teaching/praktikum/projekte/mcppHeuristikSe bastianBoenisch.tar.gz.. [Accessed 20 April 2017].
[21] R. J. Roy S., "The Capacitated Canadian Postman Problem," INFOR, vol. 29, no. 1, pp. 58-73, 1989.
[16] A. Corberan, "Arc Routing Problems: Data Instances," [Online]. Available:
http://www.uv.es/corberan/instancias.htm. [Accessed 3 April 2017].
[17] K. Helsgaun, "LKH," [Online]. Available: http://akira.ruc.dk/~keld/research/LKH/. [Accessed 9 April 2017].
[18] K. Helsgaun, "An Effective Implementation of the Lin-Kernighan Traveling Salesman Heuristic," European Journal of Operational Research, vol. 126, no. 1, pp. 106-130, 2000.
[19] K. Helsgaun, "Solving Arc Routing Problems Using the Lin-Kernighan- Helsgaun Algorithm," Roskilde University, 2014.
[20] K. Helsgaun, "Solving the Equality Generalized Traveling Salesman Problem Using the Lin-Kernighan-Helsgaun Algorithm," Roskilde University, 2014.