NEW CROSSOVER TECHNIQUE FOR GENETIC ALGORITHM (GA) FOR SOLVING TRAVELLING SALESMAN PROBLEM (TSP

11
NEW CROSSOVER TECHNIQUE FOR GENETIC ALGORITHM (GA) FOR SOLVING TRAVELLING SALESMAN PROBLEM (TSP) Özgür Saygın Bican (a) , Fatih Semiz (b) , Çağlar Seylan (c) (a) METU-TAF-MODSIMMER, [email protected] (b) METU-TAF-MODSIMMER, [email protected] (c) METU-TAF-MODSIMMER, [email protected] ABSTRACT Simple symmetric Travelling Salesman Problem (TSP) as the one may know has a combinational nature. When there are 25 or more cities (nodes) to visit, the brute force approach is not feasible. Instead, using the heuristic and the probabilistic approaches will be more reasonable for obtaining optimal or nearly optimal solutions. For this paper, Genetic Algorithm (GA), which is one of the most well-known heuristic approaches; and crossover techniques, which are the most important property of the GA’s performance, has been studied and researched. A new crossover method has been introduced by combining two different crossover methods. The introduced method has been tested by three different input from Travelling Salesman Problem Library (TSPLIB) provided by Heidelberg University (*) , and the results have been compared with the results of different crossover techniques. The new technique has been compared with different crossover techniques within the scope of the obtained path length in terms of minimum path length, maximum path length, and the average path length. In addition, possible reason of the obtained results is explained. *(http://www2.iwr.uni-heidelberg.de/groups/comopt/software/TSPLIB95/ tsp/) Keywords: Crossover Techniques, Edge Recombination Crossover (ERX), Genetic Algorithm (GA), Greedy Crossover (GX), Local Minima, Search

Transcript of NEW CROSSOVER TECHNIQUE FOR GENETIC ALGORITHM (GA) FOR SOLVING TRAVELLING SALESMAN PROBLEM (TSP

NEW CROSSOVER TECHNIQUE FOR GENETIC ALGORITHM(GA) FOR SOLVING TRAVELLING SALESMAN PROBLEM (TSP)

Özgür Saygın Bican(a), Fatih Semiz(b), Çağlar Seylan(c)

(a) METU-TAF-MODSIMMER, [email protected](b) METU-TAF-MODSIMMER, [email protected](c) METU-TAF-MODSIMMER, [email protected]

ABSTRACT

Simple symmetric Travelling Salesman Problem (TSP) as the one may knowhas a combinational nature. When there are 25 or more cities (nodes) to visit, the brute force approach is not feasible. Instead, using theheuristic and the probabilistic approaches will be more reasonable forobtaining optimal or nearly optimal solutions. For this paper, GeneticAlgorithm (GA), which is one of the most well-known heuristic approaches; and crossover techniques, which are the most important property of the GA’s performance, has been studied and researched. A new crossover method has been introduced by combining two different crossover methods. The introduced method has been tested by three different input from Travelling Salesman Problem Library (TSPLIB) provided by Heidelberg University (*), and the results have been compared with the results of different crossover techniques. The new technique has been compared with different crossover techniques withinthe scope of the obtained path length in terms of minimum path length,maximum path length, and the average path length. In addition, possible reason of the obtained results is explained.

*(http://www2.iwr.uni-heidelberg.de/groups/comopt/software/TSPLIB95/tsp/)

Keywords: Crossover Techniques, Edge Recombination Crossover (ERX),Genetic Algorithm (GA), Greedy Crossover (GX), Local Minima, Search

Pool, Travelling Salesman Problem (TSP), Partially Mapped Crossover(PMX)

INTRODUCTION

One of the most famous computational problems is Travelling Salesman Problem (TSP). Since it has a combinational nature, it is a non-deterministic polynomial-time NP complete problem. A basic explanation of TSP is as follows: A salesman with a map, including N cities and the distances between each pair of cities, aims to visit each city exactly once starting from a given city. Meanwhile, he has to find the shortest cycling path between these cities to complete histour within a minimum time period.

In a formal manner, TSP can be modeled as a graph problem. Givena starting node in an undirected weighted complete graph G with N nodes where the nodes are associated with the cities and city distances are associated with as weights. A path, starting from a given node V and finishing at the same node, visiting all the edges exactly once in G is called a Hamiltonian Cycle. Hence, TSP can be defined as finding the shortest Hamiltonian Cycle on graph G.

The problem ends up with N! different possible cycles which give a combinational nature to the problem; therefore, the brute force algorithms are not feasible. One possible solution that can be proposed is to use heuristic algorithms.

RELATED WORK

One of the most frequently used heuristic techniques to solve TSPis GA. Many approaches of GA are possible for solving TSP. The main variation point is crossover techniques which will be used in GA.

Partially Mapped Crossover (PMX) is firstly introduced by E. Goldberg and R. Lingle at 1985 as a new type of crossover operator to produce more efficient solutions to TSP [2]. The working mechanism of the PMX is as follows: [3], [4].

1. It takes two parents which have n chromosomes (each stand for acity), call them P1 and P2.

2. PMX chooses two randomly selected positions from the parent P1.

3. The chromosomes (cities) between these two randomly selected points are exchanged with the chromosomes which are standing atsame positions on P2.

As an example implementation take n, P1 and P2 as the following:n=5, P1= 5 3 4 2 1 and P2= 2 1 3 4 5.

Suppose that PMX chooses points 1 and 2. Then the cities 5-3 are selected from P1 and they will be exchanged with the cities 2-1 which are placed between the points 1 and 2. The new produced genomes are P1*= 2 1 4 5 3 and P2*= 5 3 1 4 2.

Another crossover technique is Greedy Crossover (GX) [5]. After an initial population is created, GX operator selects a random elementfrom the initial population. As a next step, it picks shortest edge possible from one of the parents, if one of them is used before it selects the edge from the other parent. If both of them are used before, then it selects a random edge until it finds an unselected edge. The main disadvantages of the GX are [9]:

The search pool dramatically shrinks, and eventually it loses many of the possible solutions because of the tendency to generate same genomes.

Solutions created by GX are generally produces crossed edges.

Another crossover technique is Edge Recombination Crossover (ERX) [6]. The procedure of the algorithm can be summarized as the following:

1. Construct an edge set for each vertex Vi. Each set Si contains union of adjacency vertexes of Vi coming from the parent genomes.

2. Choose a vertex Vi randomly as the “current city” and append it to the child genome.

3. Remove the “current city” from each of each of the edge set Si, in order to prevent from cycles.

4. If the “current city” has an empty edge set, then go to step 6. 5. Choose the vertex, which has the fewest number of elements in its

own edge set, among the edge set of the “current city”. If there are more than one such vertexes, choose randomly one from these vertexes. Append the selected vertex to the child genome and makeit the “current city”. Go to step 3.

6. If all the vertexes are used, then stop. Otherwise, go to step 2.

The main disadvantages of ERX [7]: The child genome inherits most of the sub tours and the common

edges from the parent genomes. During creating an offspring from parents it takes into

consideration quite limited amount of different edges.

Both GX and ERX are handicapped at using the search pool effectively. Hence, the possibility of getting caught too early in local minima increases. Please, note that such solutions will be probably far from optimum solution.PROPOSED ALGORITHM

The proposed method tries to avoid the disadvantages caused by GXand ERX crossover methods. The main idea is to use both GX and ERX together as a crossover. By doing so, it is expected to get better results than using them individually. Since both have some disadvantages as discussed above, the effects of the disadvantages were tried to be minimized by using them together.

Both GX and ERX have the problem of getting caught in local minima too early which is caused by not using the search pool optimally. However, using both of them individually at every crossoverphase and then inserting these two new genomes to the population made a good effect on the discussed problem. The reason why this approach more effective on finding better solutions to TSP can be basically explained as follows:

1. GX is more effective in introducing new edges than ERX.2. ERX breaks the tendency of the GX to produce same individuals

by giving new individuals to the population.Since these two new genomes created by different approaches,

storing them in the same population decreased the rate of shrinking ofsearch pool. In addition, in this approach, the difference rate between the parents and the children tends to be increase. As a result, the time of getting caught in local optimum was successfully delayed.

Selection

Figure 1. Briefly describes the proposed crossover method.

In this method, another point that provides improvement is the selection method. We used GADSSelector in GAlib library (GAlib: A C++ Library of Genetic Algorithm Components, MIT, 1996). “The deterministic sampling selector (DS) uses a two-staged selection procedure. In the first stage, each individual's expected representation is calculated. A temporary population is filled using the individuals with the highest expected numbers. Any remaining positions are filled by first sorting the original individuals according to the decimal part of their expected representation, then selecting those highest in the list. The second stage of selection is uniform random selection from the temporary population.” [8].

RESULTS

The implemented methods in the experiments use the following crossover methods;

A method uses only Greedy Crossover (GX) (Method 1) A method uses only Edge Recombination Crossover (ERX)

(Method 2) A method uses GX and Partially Mapped Crossover (PMX) (using

PMX instead of ERX in the proposed method) (Method 3) A method uses GX and ERX (Our Method)

We implemented all of the experiments with C++ language using GAlib library. Moreover, we used eil51 and rat99 as inputs from TSPLIBwhich can be found at the following link:

http://www2.iwr.uni-heidelberg.de/groups/comopt/software/TSPLIB95/tsp/

TSPLIB is provided by University of Heidelberg Germany. As this inputs are well-known and used in many experiments, it was preferred to make the experiments in these inputs.

Just because the crossover takes a big role in the effectiveness of the results, all the test methods have a crossover probability of 1

Generate one child with Greedy Crossover

Generate one child with

Insert new genomes to the

to maximize the effect of crossovers. Moreover, with the help of the Swap Mutator [8] the problem of premature convergence (namely, to stuck at local optimum) was tried to be solved [10]. The mutation rateis taken as 0.01 which optimizes our results. Interestingly, increasing or decreasing mutation rate does not work as better as 0.01.

In the experiment, the termination condition is defined as to continue evolution until 1000 new generations are produced. Furthermore, it was preferred to use a population size of 200.

As the one may know, the GA progresses probabilistically during the evolutions. In addition, GA significantly depends on initial population which is created randomly. Namely, the results changes drastically depending on the randomization. In order to provide feasible statistical information about the test results, all the methods were run 30 times on the same computer.

As a comparison of used methods, the following table shows the optimal paths, and best/worst and the average length of the paths found by the methods for the hk48, eil51 and rat99 inputs.

Input Names hk48 eil51 rat99Number of Cities 48 51 99The optimal Path found so far 11461 426 1211Best solution found by Method 1 11461 438,803 1257,51Best solution found by Method 2 11474 430.244 1281,14Best solution found by Method 3 11461 429.118 1289,44Best solution found by Our Method 11461 428,982 1231,9Worst solution found by Method 1 12780 477,518 1423,89Worst solution found by Method 2 11847 452.744 1422,15Worst solution found by Method 3 12129 462.653 1447,83Worst solution found by Our Method 11769 448,497 1409,95Average of solutions found by Method 1

11839.2 453,101 1348,36

Average of solutions found by Method 2

11651.4 441.288 1359,54

Average of solutions found by Method 3

11696.5 441.888 1360,85

Average of solutions found by Our Method

11544.5 434.842 1297,49

As the table shows clearly, taking eil51 and rat99 as examples, the GX (Method 1) is less successful than ERX (Method 2) for the inputeil51, while GX is more successful for the input rat99 than ERX. Beingsuccessful at different type of inputs is one of the reasons why combining GX and ERX provides improvement.

Figures 1a, 2a, 3a displays the distribution of the outputs obtained by the proposed method for the inputs hk48, eil51, rat99 respectively. Similarly, b, c, d parts of the figures display the distribution of the outputs obtained by Method1, Method2, Method3 which are mentioned at the beginning of this section respectively.

Figure 1a: Outputs obtained by the proposed Figure 1b: Outputs obtained by Method1

method for the input hk48 for the input hk48

Figure 1c: Outputs obtained by the Method2 Figure 1d: Outputs obtained by Method3 method for the input hk48 for the input hk48

Figure 2a: Outputs obtained by the proposed Figure 2b: Outputs obtained by Method1 method for the input eil51 for the input eil51

Figure 2c: Outputs obtained by the Method2 Figure 2d: Outputs obtained by Method3 for the input eil51 for the input eil51

Figure 3a: Outputs obtained by the proposed Figure 3b: Outputs obtained by Method1 method for the input rat99 for the input rat99

Figure 3c: Outputs obtained by the Method2 Figure 3d: Outputs obtained by Method3 for the input rat99 for the input rat99

CONCLUSIONA new method for solving TSP has been introduced by using GX and

ERX together as a new crossover method. It has been proved that the proposed method provides a improvement in the obtained results comparing when GX and ERX are used individually. Moreover, it has beenshown that the results obtained by using GX and PMX in the same mannerare not as good as the results of the introduced method. Current experimental result showed that the proposed method straitens the

output interval and decreases the average path length. In other words,the shortest path length and the longest path length obtained by the introduced method are the minimum ones among the tested methods.

REFERENCES

[1] Buthainah Fahran Al-Dulaimi, Hamza A. Ali (2008). Enhanced Traveling Salesman Problem Solving by Genetic Algorithm Technique (TSPGA), In World Academy of Science Engineering and Technology, page 38

[2] Goldberg, D. E. & Lingle, R. (1985): Alleles, loci, and the traveling salesman problem,Proceedings of an International Conference on Genetic Algorithms and Their Applications,page 154–159, Pittsburgh, PA

[3] D. B. Fogel (1988). An evolutionary approach to the travelling salesman problem, Biological Cybernetic, pages 139-144.

[4] G.Ucoluk (2002). Genetic Algorithm Solution of the TSP Avoiding Special Crossover and Mutation,Intelligent Automation and Soft Computing, 3(8), TSI Press, page 3.

[5] J. Grefenstette, R. Gopal, B. Rosmaita, and D. Van Gucht. (1985) Genetic Algorithms for theTraveling Salesman Problem, In Proc. of an International Conference on Genetic Algorithms.

[6] Whitley, Darrell; Timothy Starkweather, D'Ann Fuquay (1989). Scheduling problems and traveling salesman: The genetic edge recombination operator, International Conference on Genetic Algorithms. pages 133–140.

[7] Stephen Chen , Stephen F.Smith (1996) . Commonality and Genetic Algortihms, The Robotics Institute Carnagie Mellon University .CMU-RI-TR-96-27

[8] Matthew Wall (1996) . GAlib: A C++ Library of Genetic Algorithm Components, version 2.4Documentation Revision B, Massachusetts Institute of Technology.

[9] Zhenchao Wang, Haibin Duan, and Xiangyin Zhang (2009). An ImprovedGreedy Genetic Algorithm for Solving Travelling Salesman Problem, Fifth International Conference on Natural Computation.

[10] Seçkin Sancı (2010). A PARALLEL ALGORITHM FOR FLIGHT ROUTE PLANNING ON GPU USING CUDA, The Graduate School of Natural and Applied Sciences of Middle East Technical University, page 44.