An Enhanced Genetic Algorithm for the Generalized Traveling Salesman Problem

The generalized traveling salesman problem (GTSP) deals with finding the minimum-cost tour in a clustered set of cities. In this problem, the traveler is interested in finding the best path that goes through all clusters. As this problem is NPhard, implementing a metaheuristic algorithm to solve the large scale problems is inevitable. The performance of these algorithms can be intensively promoted by other heuristic algorithms. In this study, a search method is developed that improves the quality of the solutions and competition time considerably in comparison with Genetic Algorithm. In the proposed algorithm, the genetic algorithms with the Nearest Neighbor Search (NNS) are combined and a heuristic mutation operator is applied. According to the experimental results on a set of standard test problems with symmetric distances, the proposed algorithm finds the best solutions in most cases with the least computational time. The proposed algorithm is highly competitive with the published until now algorithms in both solution quality and running time. Keywords-genetic algorithms; traveling salesman; generalized; nearest neighbor


INTRODUCTION
Genetic Algorithm (GA) is a search heuristic that mimics the process of natural evolution [1].This heuristic algorithm (also sometimes called a metaheuristic) is routinely used to generate useful solutions to optimization and search problems.GAs belong to the larger class of evolutionary algorithms (EA), which generate solutions to optimization problems using techniques inspired by natural evolution, such as inheritance, mutation, selection, and crossover.In a genetic algorithm, a population of candidate solutions (called individuals, creatures, or phenotypes) to an optimization problem is evolved toward better solutions.Each candidate solution has a set of properties (its chromosomes or genotype) which can be mutated and altered [2].The evolution usually starts from a population of randomly generated individuals and is an iterative process, with each iteration's population called a generation.In each generation, the fitness of every individual in the population is evaluated.The fitness is usually the value of the objective function in the optimization problem being solved.The more fit individuals are stochastically selected from the current population, and each individual's genome is modified (recombined and possibly randomly mutated) to form a new generation.The new generation of candidate solutions is then used in the next iteration of the algorithm.The algorithm continues to run until one of the following criteria is met:  A pre-defined fitness score is reached  A specified number of iterations are completed or alternatively, a set time limit is reached The Generalized Traveling Salesman Problem (GTSP) is a generalized version of the Traveling Salesman Problem (TSP).In this problem, the cities are divided into a number of clusters and the traveling salesman has to find the minimum-cost tour which passes through exactly one city from each cluster.Consider R which is formed by a set of nodes that has been separated to m non-empty incompatible proper subsets: Each node has been connected by one or more arcs from E, so that each arc connects two nodes from different clusters.
( , ) i v , j v , i j , that represents the GTSP's net.The shortest tour that starts from one node of a cluster and passes through only one node of every other clusters and finishes at the starting point is desired.

II. LITERATURE REVIEW
The generalized form of TSP is called GTSP, and this problem's aim is optimizing the path between polygons instead of the single nodes.Authors in [3,4] studied precision algorithms and theoretical approaches to solve this problem.An integer linear program and also, exact and heuristic separation procedure for some classes of facet-defining inequalities, which are used within a branch-and-cut algorithm for the exact solution of GTSP was proposed in [5].In this study the best objective values of the aforementioned paper were used, in order to test the results of proposed algorithm.
Authors in [6] developed an innovative algorithm for minimizing airtime of a cutting tool.3ρ/2 approximation algorithm has been presented in [7], where ρ is the number of cities in the largest cluster while the worst-case bound may be weak, as ρ may be quite large.Another approximation algorithm for the group Steiner tree problem has been proposed in [8].In both [7,8], the triangle inequality must be satisfied.Authors in [9] proposed an efficient innovative approach for solving GTSP.In their method, random-key GA is combined with a local tour improvement heuristic to improve the quality of solutions and the time required for obtaining them.A particle swarm optimization based algorithm was recently developed as well by authors in [10].Also, an ant colony optimization (ACO) is used to solve GTSP in [11].Authors in [12] proposed a GA with several new features, including isolated initial populations and a new reproduction mechanism based on the TSP ordered crossover operator.This new mechanism was called mrOX, for modified rotational ordered crossover.Another way to solve the GTSP is to turn it into the TSP [13].The procedure of adaptation of a TSP neighborhood for the GTSP has been formalized in [14].Authors in [15] proposed Memetic Algorithm to solve the GTSP where the crossover operator relies on large neighborhood search.Their main contribution was the originality of their crossover procedure.The Lin-Kernighan heuristic is known to be a very successful TSP one.A number of adaptations of Lin-Kernighan for the GTSP are presented by authors in [14].They have discussed several approaches to adapt TSP local search for the GTSP.Authors in [16] have extended the ant colony optimization method from TSP to GTSP and based on the basic extended ACO method, they have developed an improved method by considering the group influence, besides a mutation process and a local search technique, namely 2-OPT search has been applied.Applications of the GTSP are also discussed in [17].A local-global approach for the generalized traveling salesman problem and also an efficient algorithm for solving the problem based on genetic algorithms is proposed in [18,19].A new memetic algorithm to solve the symmetric and asymmetric instances of GTSP which is called GK is presented by authors in [20].Their new memetic algorithm due to powerful local search, well-fitted genetic operators and new efficient termination condition improved the older versions and the given experimental results show its capability.Local-global approach for the GTSP is presented in [19].A novel hybrid metaheuristic algorithm approach using genetic algorithms is described based on this approach.Computational results are reported and compared for Euclidean TSP-lib instances.Results show that the proposed hybrid algorithm leads to good solutions in a reasonable amount of time.Also, the consultantguided search technique with a local-global approach is combined by authors in [21] in order to solve efficiently the GTSP.They use candidate lists in order to reduce the search space and they introduce efficient variants of 2-opt and 3-opt local search in order to improve the solutions.Different local search implementations e.g.2-opt, 3-opt, k-op and swap have been compared empirically by authors in [14].An ensemble of discrete differential evolution algorithms with parallel populations is presented in [22].In a single populated discrete differential evolution (DDE) algorithm, the destruction and construction (DC) procedure is employed to generate the mutant population whereas the trial population is obtained through a crossover operator.

III. MATHEMATICAL FORMULATION
Mathematical formulation will provide us the other aspect of the problem which will be an instrumental tool for pondering.Also the IP formulation can help us towards finding other powerful algorithms in future researches.By considering these facts, researchers try to present the exhaustive and easy to understand IP formulation.Six distinct formulations of the GTSP as an integer programming are described in [23].These IP formulations are "compact" in the sense that the number of constraints and variables is a polynomial function of the number of nodes in the problem.In this paper, a new IP formulation is described.Symbols used in the presented mathematical model are as follows:  By considering the cited symbols above, the mathematical model of the problem will be composed of one objective function and some constraints.After introducing the mathematical model, the descriptions about the objective function and constraints will be given.

etasr.com Jafarzadeh et al.: An Enhanced Genetic Algorithm for the Generalized Traveling
Objective function shows the total cost of traveling that should be minimized.The first constraint emphasizes that exactly one node from each cluster should be chosen.The second and third constraints state that the maximum number of output and input arcs is one.The fourth and the fifth constraints ensure that there is not any sub-tour in travelled rout.And finally, last three definitions show that the used variables are Boolean.

IV. GENETIC ALGORITHM APPROACH FOR GTSP
In this section, the constructive sections of genetic algorithm and the quantity of the parameters for solving the GTSP are presented.The most suitable amount for these parameters has been found by trial and error.

A. Chromosome Representation
Figure 1 illustrates the bipartite chromosome that has been used.Assume that m, is the number of clusters and n 1 , n 2 , ….., n m represent the number of nodes in each cluster respectively.Let m=8, n 1 =3, n 2 =8, n 3 =3, n 4 =5, n 5 =6, n 6 =4, n 7 =6, n 8 =7.A possible solution is shown in Figure 1.The first row contains integers 1 to 8 that represents the sequence of clusters that have been visited by the traveling salesman.Numbers in the second row represent the city chosen from each cluster.So this chromosome suggests that the traveling salesman should start his trip by visiting the fourth city from the fifth cluster and after finishing his job should go to the fifth city from the seventh cluster.By using this type of chromosome, there will be m! ways to arrange numbers on the first row and there are also n i possible arrangements for the i th cluster.So, for a problem with m clusters and , {1, 2,..., } possible forms which are the size of the solution space.
After computing the fitness of each chromosome, the algorithm directly passes chromosome of highest fitness value to the next generation.Therefore, the best solution is never lost.The fitness function plotted by the algorithm is always ascending type.

B. Reproduction
When a new population is created, the algorithm replaces 10% of the worst solutions with a random population.This way, the diversity would be preserved and a larger area of the solution space would be covered.

C. Crossover
In this algorithm, a simplified Greedy Selection Crossover (GSX) operator is used.This operator is adapted for the bipartite.The major merits of this operator would be revealed in problems of a larger size.In this kind of cross over, a similar city is selected arbitrarily in both chromosomes.This city is put in the first gen of offspring.In these parents, we have two cities right next to the selected first gen.Their distance from the first gen is considered and the nearest one is selected as the second gen.We will do the described step for the third city etc.The function of this operator for TSP with per mutative chromosome coding is described thoroughly by [24].

D. Mutation
An improving mutation operator is utilized in this algorithm.We know that an optimal path in this problem does not have any crossing segments, and mutation operator applies this theorem to promote the quality of the existing solutions.A random chromosome is picked, and each consecutive pair of its genes that makes a connecting line between two centers is analyzed for possible crossing with other pairs.If the algorithm finds such couple of pairs it exchanges those genes.

E. Nearest Neighbor Search
Nearest Neighbor Search (NNS) is an optimization problem for finding the closest points in metric spaces.The problem is:   given a set of points in a metric space M and a query point q M  , find the closest point in S to q.In this paper, NNS algorithm is used for promoting efficiency of GA for solving the GTSP.In the given pseudocode, c shows a sample chromosome from GA that is related randomly from the population.The algorithm generates two integer and random numbers (i.e.line 2) to pick a string of genes between them and then apply NNS on the extracted string.This string is showed by  in the third line.The improved string will be returned by  at the end of algorithm which has been pre-allocated in line 4.In the provided loop, algorithm finds the closest point to the point that already exists in the  .Then, it searches within the remaining points that have not been assigned yet, and it repeats these steps till reordering all the selected points as string  .The algorithm stops when (i) the best solution that has been obtained by algorithm, appears repeatedly in a specific number of iterations or (ii) when a specific number of iterations is performed.

V. COMPUTATIONAL RESULTS
The number of iterations to meet the first termination criterion was set to 250 and the second criterion will differ from problem to problem, the population size iteration was set to 60, the crossover rate was set to 85% and the mutation rate was set to 5%.In every case, the best solution was obtained in less than 0.4 seconds.For investigating the efficiency of the proposed algorithm, standard test problems that are generated in [20] were solved and the results of them were collected in Tables I and II.Table I, presents the computational results in both terms of quality of solutions and CPU time.In Table II, the results of comparison between GA, Nearest Neighbor Search, GA+NNS and GK have been illustrated.GK is a state-of-the-art algorithm for solving the GTSP which is presented by [20].

2
"Problem" shows the standard test problem."Best" presents the best known objective function value for each problem."Best obtained value" is the objective value that proposed algorithm reached."Opt" represents the number of trials that algorithm obtained the best known objective function value in 10 time runs."Average" illustrates the mean of obtained tour length in 10 time runs."Err (%)" represents the relative error, where the relative error is calculated as: