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.

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.

No. of Edges
Population Size
No. of Generations
Random Population
For each
For each
Distance square-root
For each
For each 1 ≤ generation ≤ G
For each
Sum1 Distance
For each
Sum1 + Sum2
Length Length
For each
C1 zeros()
C2 zeros()
St1 0
St2 0
Where (Length(C1) ~= Length(P1))
(St1) (St1)
While ()
Ind1 find(P1 == C1(St1))
Val1 ←P2(Ind1)
(St2) Val1
St1 St1 + 1
Ind2 find(P2 == C2(St2))
Val2 (Ind2)
C1(St1) Val2
St2 St2 + 1
For each
Sum1 Distance
For each
Sum2 Distance
R← Sort()

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 3 summarizes the results and shows that the performance of CX2 is much better than the two existing crossover operators with 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.

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.


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.