Table of Contents Author Guidelines Submit a Manuscript
Computational Intelligence and Neuroscience
Volume 2017 (2017), Article ID 7430125, 7 pages
https://doi.org/10.1155/2017/7430125
Research Article

Genetic Algorithm for Traveling Salesman Problem with Modified Cycle Crossover Operator

1Department of Statistics, Quaid-i-Azam University, Islamabad, Pakistan
2Department of Computer Science, Foundation University, Islamabad, Pakistan
3Arriyadh Community College, King Saud University, Riyadh, Saudi Arabia
4KSA Workers University, El Mansoura, Egypt
5College of Business Administration, King Saud University, Muzahimiyah, Saudi Arabia

Correspondence should be addressed to Yousaf Shad Muhammad

Received 1 June 2017; Revised 17 July 2017; Accepted 7 August 2017; Published 25 October 2017

Academic Editor: Silvia Conforto

Copyright © 2017 Abid Hussain et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

Abstract

Genetic algorithms are evolutionary techniques used for optimization purposes according to survival of the fittest idea. These methods do not ensure optimal solutions; however, they give good approximation usually in time. The genetic algorithms are useful for NP-hard problems, especially the traveling salesman problem. The genetic algorithm depends on selection criteria, crossover, and mutation operators. To tackle the traveling salesman problem using genetic algorithms, there are various representations such as binary, path, adjacency, ordinal, and matrix representations. In this article, we propose a new crossover operator for traveling salesman problem to minimize the total distance. This approach has been linked with path representation, which is the most natural way to represent a legal tour. Computational results are also reported with some traditional path representation methods like partially mapped and order crossovers along with new cycle crossover operator for some benchmark TSPLIB instances and found improvements.

1. Introduction

Genetic algorithms (GAs) are derivative-free stochastic approach based on biological evolutionary processes proposed by Holland [1]. In nature, the most suitable individuals are likely to survive and mate; therefore, the next generation should be healthier and fitter than previous one. A lot of work and applications have been done about GAs in a frequently cited book by Golberg [2]. GAs work with population of chromosomes that are represented by some underlying parameters set codes.

The traveling salesman problem (TSP) is one of the most famous benchmarks, significant, historic, and very hard combinatorial optimization problem. TSP was documented by Euler in 1759, whose interest was in solving the knight’s tour problem [3]. It is the fundamental problem in the fields of computer science, engineering, operations research, discrete mathematics, graph theory, and so forth. TSP can be described as the minimization of the total distance traveled by touring all cities exactly once and return to depot city. The traveling salesman problems (TSPs) are classified into two groups on the basis of the structure of the distance matrix as symmetric and asymmetric. The TSP is symmetric if , , where and represent the row and column of a distance (cost) matrix, respectively, otherwise asymmetric. For cities, there are possible ways to find the tour after fixing the starting city for asymmetric and its half for symmetric TSP. If we have only 10 cities, then there are 362,880 and 181,440 ways for asymmetric and symmetric TSP, respectively. This is the reason to say TSP is NP-hard problem. TSP has many applications such as variety of routing and scheduling problems, computer wiring, and movement of people, X-ray crystallography [4], and automatic drilling of printed circuit boards and threading of scan cells in a testable Very-Large-Scale-Integrated (VLSI) circuits [5].

Over the last three decades, TSP received considerable attention and various approaches are proposed to solve the problem, such as branch and bound [6], cutting planes [7], 2-opt [8], particle swarm [9], simulated annealing [10], ant colony [11, 12], neural network [13], tabu search [14], and genetic algorithms [3, 1517]. Some of these methods are exact, while others are heuristic algorithms. A comprehensive study about GAs approaches are successfully applied to the TSP [18]. A survey of GAs approaches for TSP was presented by Potvin [17]. A new sequential constructive crossover generates high quality solution to the TSP by Ahmed [19]. A new genetic algorithm for asymmetric TSP is proposed by Nagata and Soler [20]. Three new variations for order crossover are presented with improvements by Deep and Adane [21]. Ghadle and Muley presented modified one’s algorithm with MATLAB programming to solve TSP [22]. Piwonska associated a profit based genetic algorithm with TSP and obtained good results to be tested on networks of cities in some voivodeships of Poland [23]. Kumar et al. presented the comparative analysis of different crossover operators for TSP and showed partially mapped crossover gives shortest path [24]. A simple and pure genetic algorithm can be defined in the following steps.

Step 1. Create an initial population of P chromosomes.

Step 2. Evaluate the fitness of each chromosome.

Step 3. Choose P/2 parents from the current population via proportional selection.

Step 4. Randomly select two parents to create offspring using crossover operator.

Step 5. Apply mutation operators for minor changes in the results.

Step 6. Repeat Steps  4 and 5 until all parents are selected and mated.

Step 7. Replace old population of chromosomes with new one.

Step 8. Evaluate the fitness of each chromosome in the new population.

Step 9. Terminate if the number of generations meets some upper bound; otherwise go to Step  3.

The selection criteria, crossover, and mutation are major operators, but crossover plays a vital role in GAs. A lot of crossover operators have been proposed in literature and all have their significant importance. In this article, we also proposed a new crossover operator for TSP which is moved within two selected parents as previous cycle crossover operator. In Section 2, we present crossover operators for TSP and proposed a new crossover operator for path representation in Section 3; computational experiments and discussion are in Section 4 and conclusion is in Section 5.

2. Crossover Operators for TSP

In literature, there are many representations to solve the TSP using the GAs. Among these binary, path, adjacency, ordinal, and matrix representations are important. The further types of these representations are given in Table 1. We are limiting our self only with the path representation which is most natural and legal way to represent a tour and skip the others representations.

Table 1: Summary of crossover operators for TSP.
2.1. Path Representation

The most natural way to present a legal tour is probably by using path representation. For example, a tour can be represented simply as (1 4 8 2 5 3 6 7).

Since the TSPs in combinatorial with the path representation and the classical crossover operators such as one-point, two-point, and uniform crossovers are not suitable, we choose only partially mapped, order, and cycle crossover operators from path representation which are mostly used in literature and also we can compare our proposed crossover operator with these operators.

2.1.1. Partially Mapped Crossover Operator

The partially mapped crossover (PMX) was proposed by Goldberg and Lingle [25]. After choosing two random cut points on parents to build offspring, the portion between cut points, one parent’s string is mapped onto the other parent’s string and the remaining information is exchanged. Consider, for example, the two parents tours with randomly one cut point between 3rd and 4th bits and other cut point between 6th and 7th bits are as follows (the two cut points marked with “”):The mapping sections are between the cut points. In this example, the mapping systems are , , and . Now two mapping sections are copied with each other to make offspring as follows:

Then we can fill further bits (from the original parents), for those which have no conflict as follows:

Hence, the first in the first offspring is 8 which comes from first parent but 8 is already in this offspring, so we check mapping and see again 1 existing in this offspring, again check mapping , so 2 occupies at first ×. Similarly, the second × in first offspring is 6 which comes from first parent but 6 exists in this offspring; we check mapping as well, so 7 occupies at second . Thus the offspring 1 isAnalogously, we complete second offspring as well:

2.1.2. Order Crossover Operator

The order crossover (OX) was proposed by Davis [26]. It builds offspring by choosing a subtour of a parent and preserving the relative order of bits of the other parent. Consider, for example, the two parents tours are as follows (with randomly two cut points marked by “”):The offspring are produced in the following way. First, the bits are copied down between the cuts with similar way into the offspring, which givesAfter this, starting from the second cut point of one parent, the bits from the other parent are copied in the same order omitting existing bits. The sequence of the bits in the second parent from the second cut point is “.” After removal of bits 2, 7, and 1, which are already in the first offspring, the new sequence is “.” This sequence is placed in the first offspring starting from the second cut point:Analogously, we complete second offspring as well:

2.1.3. Cycle Crossover Operator

The cycle crossover (CX) operator was first proposed by Oliver et al. [27]. Using this technique to create offspring in such a way that each bit with its position comes from one of the parents. For example, consider the tours of two parents:Now it is up to us how we choose the first bit for the offspring to be either from the first or from the second parent. In our example, the first bit of the offspring has to be 1 or 8. Let us choose it be 1:Now every bit in the offspring should be taken from one of its parents with the same position, it means that further we do not have any choice, so the next bit to be considered must be bit 8, as the bit from the second parent is just below the selected bit 1. In first parent this bit is at 8th position; thusThis turnout implies bit 7, which is the bit of second parent just below the selected bit at 7th position in first parent. ThusNext, this forced us to put 4 at 4th position asAfter this, 1 comes which is already in the list; thus we have completed a cycle and filling the remaining blank positions with the bits of those positions which are in second parent:Similarly the second offspring isBut there is a drawback that sometimes this technique produces same offspring, for example, the following two parents:After applying CX technique, the resultant offspring are as follows:which are the exactly the same as their parents.

3. Proposed Crossover Operators

We are going to propose a new crossover operator which works similarly as CX, so we suggest it as CX2. At the same time it generates both offspring from parents using cycle(s) till last bit. We differentiate CX2 in the following steps.

Step 1. Choose two parents for mating.

Step 2. Select 1st bit from second parent as a 1st bit of first offspring.

Step 3. The selected bit from Step  2 would be found in first parent and pick the exact same position bit which is in second parent and that bit would be found again in the first parent and, finally, the exact same position bit which is in second parent will be selected for 1st bit of second offspring.

Step 4. The selected bit from Step  3 would be found in first parent and pick the exact same position bit which is in second parent as the next bit for first offspring. (Note: for the first offspring, we choose bits only with one move and two moves for second offspring’s bits.)

Step 5. Repeat Steps  3 and 4 till 1st bit of first parent will not come in second offspring (complete a cycle) and process may be terminated.

Step 6. If some bits are left, then the same bits in first parent and in second offspring till now and vice versa are left out from both parents. For remaining bits repeat Steps  2, 3, and 4 to complete the process.

According to the previous steps, we derive two cases for CX2. First case of CX2 will be terminated within Step  5 and second will take all six steps. We provide detailed examples of both cases in next subsections.

3.1. CX2: Case  1

Consider the two selected parents as mentioned in Step  1:Using Step  2,As using Step  3 which selected 4 in Step  2, where 4 is found at second position in first parent and the bit at this position in second parent is 2. For searching again, 2 is at fourth position in first parent and 1 is at same position in second parent, so 1 is selected for second offspring as follows:To follow Step  4, the previous bit was 1 and it is located at 6th position in first parent and at this position bit is 8 in second parent, soAnd for two moves below 8 is 5 and below 5 is 7, soHence similarly,We see that the last bit of second offspring is 3 which was the 1st bit of first parent. Hence proposed scheme is over within one cycle.

3.2. CX2: Case  2

Consider the two selected parents as mentioned in Step  1:Now using Step  2 of the scheme,After this, Step  3 calls us to locate the position of bit 2 in first parent, which is at 2nd and 7 is at same position in second parent, again searching bit 7 in first parent and located at 7th position and 6 is at the same position in second parent, so we choose bit 6 for second offspring: Continue Steps  4 and 5 as well:The Step  5 is finished because bit 1 has come in second offspring which was in 1st position of first parent. Now before applying Step  6, we match first offspring’s bits with second parent or vice versa and leave out the existing bits with their position in both parents as follwos:Now filled positions of parents and “×” positions of offspring are considered 1st, 2nd, and 3rd positions, and so forth, so we can complete Step  6 as well:

Hence the scheme is over with efficient work.

To apply this crossover operator, we made a MATLAB code for genetic algorithms and have given pseudo-code in Algorithm 1.

Algorithm 1: Pseudo-code of proposed algorithm CX2.

4. Computational Experiments and Discussion

We use genetic algorithm in MATLAB software to compare the proposed crossover operator with some traditional path representation crossover operators. Our first experiment has 7 cities and we impose the transition distance between cities in Table 2. To solve this problem using GAs, the genetic parameters are set as population size, ; maximum generation, ; crossover probability, = 0.8; mutation probability, = 0.1. In this experiment, the optimal path and optimal value are and 159, respectively.

Table 2: Transition distance between cities.

Table 3 summarizes the results and shows that the performance of CX2 is much better than the two existing crossover operators with 30 runs.

Table 3: Comparison of three crossover operators (30 runs).
4.1. Benchmark Problems

We perform the proposed crossover operator CX2 along two traditional crossover operators PMX and OX on twelve benchmark instances which are taken from the TSPLIB [28]. In these twelve problems, the ftv33, ftv38, ft53, kro124p, ftv170, rbg323, rbg358, rbg403, and rbg443, are asymmetric and gr21, fri26, and dantzig42 are symmetric TSPs. The experiments are performed 30 times (30 runs) for each instance. The common parameters are selected for GAs, that is, population size, maximum generation, crossover, and mutation probabilities are 150, 500, 0.80, and 0.10, respectively, for less than 100 size instances and results describes in Table 4. Only two changes for more than 100 size instances, that is, population size and maximum generation are 200 and 1000, respectively, and results are described in Table 5. Both tables demonstrate comparison of proposed crossover operator with two existing crossover operators with best, worst, and average results. These results show that the solution quality of the proposed algorithm and with existing crossovers operators are insensitive to the number of runs but number of generations are sensitive, especially in Table 5.

Table 4: Comparison results among three crossover operators.
Table 5: Comparison results among three crossover operators.

In Table 4, CX2 is performing with other two operators, for instance, gr21 and ftv33, on average basis. Proposed operator gives best average results for instances fri26, ftv38, dantzig42, and ft53. For instance dantzig42, the proposed operator CX2, gives exact optimum value (best known value) sixteen out of thirty times. But for this instance, PMX and OX do not give us an exact value for any run and also we found that the best tour generated with CX2 is 75 and 86 percent shorter than the OX and PMX best tours, respectively. For instance ft53, we found 22 and 26 percent shorter distance than PMX and OX best tours respectively. More interesting aspect about CX2 is that the worst values of dantzig42 and ft53 are much better than others best values.

In Table 5, the results show that all crossover operators work on similar pattern and also found less variations among best, worst, and average values. PMX and OX perform slightly better than CX2 in the instance for rbg323 and for all others instances; the performance of CX2 falls between other two operators except ftv170. For instance, for ftv170, CX2 performs much better than other two with 108 and 137 percent shorter distance of best tours values from PMX and OX, respectively.

Finally, the overall results summarize that the proposed approach CX2 performs better on some aspects similar to existing PMX and OX crossover operators.

5. Conclusion

Various crossover operators have been presented for TSP with different applications by using GAs. The PMX and OX along with proposed crossover operator CX2 are mainly focused in this article. At first, we apply these three operators on a manual experiment and found that CX2 performs better than PMX and OX crossovers. Also, for a global performance, we take twelve benchmark instances from the TSPLIB (traveling salesman problem library). We apply all three crossover operators on these benchmark problems. We observe that the proposed operator works over 20, 70, and 100 percent for ft53, dantzig42, and ftv170 problems, respectively, compared to the other two operators. We see that, for large number of instances, the proposed operator CX2 is performing much better than PMX and OX operators. We suggest that CX2 may be a good candidate to get accurate results or may be a fast convergent. Moreover, researchers will be more confident to use it for comparisons.

Conflicts of Interest

The authors declare that there are no conflicts of interest regarding the publication of this paper.

Acknowledgments

The authors extend their appreciation to the Deanship of Scientific Research at King Saud University for funding this work through Research Group no. RG-1437-027.

References

  1. J. H. Holland, Adaptation in Natural and Artificial Systems: An Introductory Analysis with Applications to Biology, Control, and Artificial Intelligence, University of Michigan Press, Oxford, UK, 1975. View at MathSciNet
  2. D. E. Golberg, Genetic algorithms in search, optimization and machine learning, Addison-Wesley Publishing Company, 1989.
  3. P. Larrañaga, C. M. H. Kuijpers, R. H. Murga, I. Inza, and S. Dizdarevic, “Genetic algorithms for the travelling salesman problem: a review of representations and operators,” Artificial Intelligence Review, vol. 13, no. 2, pp. 129–170, 1999. View at Publisher · View at Google Scholar · View at Scopus
  4. R. G. Bland and D. F. Shallcross, “Large traveling salesman problems arising from experiments in x-ray crystallography: a preliminary report on computation,” Operations Research Letters, vol. 8, no. 3, pp. 125–128, 1989. View at Publisher · View at Google Scholar · View at MathSciNet · View at Scopus
  5. C. Ravikumar, “Parallel techniques for solving large scale travelling salesperson problems,” Microprocessors and Microsystems, vol. 16, no. 3, pp. 149–158, 1992. View at Publisher · View at Google Scholar · View at Scopus
  6. G. Finke, A. Claus, and E. Gunn, “A two-commodity network flow approach to the traveling salesman problem,” vol. 41, pp. 167–178. View at Google Scholar · View at MathSciNet
  7. P. Miliotis, “Using cutting planes to solve the symmetric Travelling Salesman problem,” Mathematical Programming, vol. 15, no. 1, pp. 177–188, 1978. View at Publisher · View at Google Scholar · View at MathSciNet · View at Scopus
  8. S. Lin and B. W. Kernighan, “An effective heuristic algorithm for the traveling-salesman problem,” Operations Research, vol. 21, pp. 498–516, 1973. View at Publisher · View at Google Scholar · View at MathSciNet · View at Scopus
  9. J. Kennedy, R. C. Eberhart, and Y. Shi, Swarm intelligence, morgan kaufmann publishers, Inc., San Francisco, CA, USA, 2001.
  10. S. Kirkpatrick and G. Toulouse, “Configuration space analysis of travelling salesman problems,” Le Journal de Physique, vol. 46, no. 8, pp. 1277–1292, 1985. View at Publisher · View at Google Scholar · View at MathSciNet
  11. M. Dorigo and L. M. Gambardella, “Ant colony system: a cooperative learning approach to the traveling salesman problem,” IEEE Transactions on Evolutionary Computation, vol. 1, no. 1, pp. 53–66, 1997. View at Publisher · View at Google Scholar · View at Scopus
  12. M. Dorigo, V. Maniezzo, and A. Colorni, “Ant system: optimization by a colony of cooperating agents,” IEEE Transactions on Systems, Man, and Cybernetics, Part B: Cybernetics, vol. 26, no. 1, pp. 29–41, 1996. View at Publisher · View at Google Scholar · View at Scopus
  13. S. Bhide, N. John, and M. R. Kabuka, “A Boolean Neural Network Approach for the Traveling Salesman Problem,” IEEE Transactions on Computers, vol. 42, no. 10, pp. 1271–1278, 1993. View at Publisher · View at Google Scholar · View at Scopus
  14. F. Glover, “Artificial intelligence, heuristic frameworks and tabu search,” Managerial and Decision Economics, vol. 11, no. 5, pp. 365–375, 1990. View at Publisher · View at Google Scholar · View at Scopus
  15. Z. Michalewicz, Genetic Algorithms + Data Structures = Evolution Programs, Springer, New York, NY, USA, 1996. View at Publisher · View at Google Scholar · View at MathSciNet
  16. C. Moon, J. Kim, G. Choi, and Y. Seo, “An efficient genetic algorithm for the traveling salesman problem with precedence constraints,” European Journal of Operational Research, vol. 140, no. 3, pp. 606–617, 2002. View at Publisher · View at Google Scholar · View at MathSciNet · View at Scopus
  17. J.-Y. Potvin, “Genetic algorithms for the traveling salesman problem,” Annals of Operations Research, vol. 63, pp. 339–370, 1996. View at Publisher · View at Google Scholar · View at Scopus
  18. M. Gen and R. Cheng, Genetic Algorithms and Engineering Design, John Wiley & Sons, London, UK, 1997. View at Publisher · View at Google Scholar
  19. H. Z. Ahmed, “Genetic algorithm for the traveling salesman problem using sequential constructive crossover operator,” in Proceedings of the International Journal of Biometrics & Bioinformatics (IJBB), vol. 3, p. 96, 2010.
  20. Y. Nagata and D. Soler, “A new genetic algorithm for the asymmetric traveling salesman problem,” Expert Systems with Applications, vol. 39, no. 10, pp. 8947–8953, 2012. View at Publisher · View at Google Scholar · View at Scopus
  21. K. Deep and H. M. Adane, “New variations of order crossover for travelling salesman problem,” International Journal of Combinatorial Optimization Problems and Informatics, vol. 2, no. 1, 2011. View at Google Scholar
  22. K. P. Ghadle and Y. M. Muley, “Travelling salesman problem with {MATLAB} programming,” International Journal of Advances in Applied Mathematics and Mechanics, vol. 2, no. 3, pp. 258–266, 2015. View at Google Scholar · View at MathSciNet
  23. A. Piwonska, “Genetic algorithm finds routes in travelling salesman problem with profits. Zeszyty Naukowe Politechniki Bia lostockiej,” Informatyka, pp. 51–65, 2010. View at Google Scholar
  24. N. Kumar, R. K. Karambir et al., “A comparative analysis of pmx, cx and ox crossover operators for solving traveling salesman problem,” International Journal of Latest Research in Science and Technology, vol. 1, 2012. View at Google Scholar
  25. D. Goldberg and R. Lingle, “Alleles, Loci and the Traveling Salesman Problem,” in Proceedings of the 1st International Conference on Genetic Algorithms and Their Applications, vol. 1985, pp. 154–159, Los Angeles, USA.
  26. L. Davis, “Applying adaptive algorithms to epistatic domains,” IJCAI, vol. 85, pp. 162–164, 1985. View at Google Scholar
  27. I. M. Oliver, D. J. d. Smith, and R. C. J. Holland, “Study of permutation crossover operators on the traveling salesman problem,” in Genetic algorithms and their applications: proceedings of the second International Conference on Genetic Algorithms: July 28-31, 1987 at the Massachusetts Institute of Technology, Cambridge, MA, USA, 1987. View at Google Scholar
  28. G. Reinelt, http://www.iwr.uni-heidelberg.de/group/comopt/software.