• Nenhum resultado encontrado

SOLUTION OF TRAVELING SALESMAN PROBLEM ON SCX BASED SELECTION WITH PERFORMANCE ANALYSIS USING GENETIC ALGORITHM

N/A
N/A
Protected

Academic year: 2017

Share "SOLUTION OF TRAVELING SALESMAN PROBLEM ON SCX BASED SELECTION WITH PERFORMANCE ANALYSIS USING GENETIC ALGORITHM"

Copied!
8
0
0

Texto

(1)

SOLUTION OF TRAVELING

SALESMAN PROBLEM ON SCX BASED

SELECTION WITH PERFORMANCE

ANALYSIS USING GENETIC

ALGORITHM

SOURAV SAMANTA

Department Of Computer Science & Engineering JIS College of Engineering, WBUT Kalyani, 741235, Nadia,West Bengal, India

sourav.uit@gmail.com

ANWESHA DE

Department Of Computer Science & Engineering DR. B. C. Roy Engineering College ,WBUT Durgapur, 713206, Burdwan,Westbengal,India

anwesha.it@gmail.com

SATRUGHNA SINGHA

Department Of Computer Science & Engineering JIS College of Engineering, WBUT Kalyani, 741235, Nadia,West Bengal, India

satrughna.singha@gmail.com

Abstract:

In this paper the implementation and performance of a new unconventional selection operator for Genetic Algorithm have been emphasized. The operator has been tuned specifically to solve the Travelling Salesman Problem. The proposed Selection Operator has been utilized based on Sequential Constructive Crossover. Here the parent’s structure has been chosen as selection criteria of a chromosome to survive for the next generations. Also it is observed that how much the low cost gene sequences of its parent’s structure to optimize the fitness of individuals has been maintained .It has been shown experimentally that the better convergence to optimal and near optimal solution compared to the traditional TSP with Conventional genetic operators has been achieved.

Keywords: Travelling Salesman Problem, Genetic Algorithm, Sequential Constructive Crossover Operator (SCX) , Sequential Constructive Crossover Based Selection (SCXBS) operator.

1. Introduction

(2)

one has found any really efficient way of solving them for large problem size. Also, NP-complete problems are known to be more or less equivalent to each other; if one knows how to solve one of them one could solve the lot. This paper is organized as follows. The preliminary concepts of TSP and Genetic Algorithm have been discussed in the first two sections. In the next part a genetic algorithm based on SCX for the TSP has been developed. Then a new selection strategy based on SCX has been proposed in next section. Computational experiments for the proposed selection operator and conclusion have been described in last two sections of this paper.

2. Background

2.1 Travelling Salesman Problem

The TSP is a classical NP-Complete combinatorial optimization problem which comes up in different situations in our world .The TSP was first introduced by Karl Menger, in Vienna, and Harvard Universities and its significance was raised at Princeton University in 1930’s. [2]. It is also the most studied problem for finding optimal solution. It can be stated as – N points (cities) as well as the cost of traveling between each pair of them are given. Assume that a sales person starting from a given city has to visit each city exactly once and should come back to the starting city to complete the tour. The aim is to find out the optimum tour in which the total cost is minimized. More formally TSP can be formulated as problem of graph theory. Given a graph G on a set of N vertices and the distances (costs of travelling) between each pair of cities as cost matrix matrix C = [cij] of order N associated with ordered node pairs (i, j). The objective is to find a close tour with a minimum-cost that visits each city once returning to the starting city i.e finding the shortest Hamiltonian cycle through G. On the basis of the structure of the cost matrix, the TSPs are classified into two groups symmetric and asymmetric. The TSP is symmetric if Cij = Cji, for all i, j and asymmetric otherwise. For an n-city asymmetric TSP, there are (N −1)! Possible solutions, one or more of which gives the minimum cost. For an n-city symmetric TSP, there are (N −1)!/2 possible solutions along with their reverse cyclic permutations having the same total cost. In either case the number of solutions becomes extremely large for even moderately large N so that an exhaustive search is impracticable .Since TSP is NP complete the corresponding optimization problems are therefore NP hard.The best known algorithms have exponential (deterministic) rum time complexity. Such combinatorial optimization problems are in the domain of Genetic algorithms [15] that’s why TSP has been solved through GA though, as far as the heuristic approach is concerned, It has been provided many algorithms for finding near optimal solutions for symmetric as well as asymmetric TSP.

2.2 Genetic Algorithm

The genetic randomize search and optimization technique guided by the principal of natural genetic system and natural evolution [10,14]. It includes the “survival of the fittest” idea into a Search Algorithm. In nature the fittest individuals are most likely to survive and mate; therefore the next generation should be fitter and healthier because they were bred from healthy parents. This same idea is applied by a GA to a problem by first ‘guessing’ the possible solutions of the related problem and then combining the fittest solution to create a new generation of solutions which should be better than the previous generation. Also, a random mutation element has included to make up the occasional mishap in nature. Genetic Algorithms have been applied to a large number of real world problems. The concept using these “evolutionary computing algorithms” for combinatorial optimization problems has been a well-studied problem-solving approach. The benefit of evolutionary computing is not only its simplicity but also its ability to obtain global optima. The main advantages of genetic algorithm is it works with the coding of variable which discretizes the search space. It works on a population of points at a time in parallel. It is nondeterministic approach that supports multi objective optimization.

3. Genetic Algorithm To Solve TSP With SCXBS Operator Proposed Selection

(3)

behind each operator is same.So to solve domain specific problem specialized GA operators are required. Structure of Genetic Algorithms to solve TSP is given below.:-

GA( )

{

Initialize random population;

Perform GENE_REPAIRING procedure.

Evaluate the population according to the fitness function; Generation = 0;

While (termination criterion is not satisfied) {

Generation = Generation + 1;

Select fitter chromosomes by survivor selection procedure; Perform crossover with probability of crossover (Pc); Perform mutation with probability of mutation (Pm); Evaluate the population;

} } 3.1.1 Encoding

In conventional approach a chromosome which is devised to represent a solution constitutes of N (counts the no of cities) genes. Each gene holds a number which is a label of a city. So nth gene hold the label of the city which is visited nth in that particular tour. In other words the chromosome is a direct coding of a permutation of the sequences 1,2…….N.To start with a population of valid chromosome gene repairing is needed where each invalid chromosome (with repetition of cities) are fed into an intermediate process which transform them into valid once.

3.1.2 Crossover

Crossover is nothing but recombination of parents. It is the most important operation of a GA because in this operation, characteristics are exchanged between the individuals of the population. the main constraints on crossover operators for TSP is that there should not be any repetition of cities in a particular chromosome, that’s why it is not possible to use 1 point,2 point crossover (except the case of Inversion sequence crossover[3]). Since the crossover operator plays a vital role in GA, so many crossover operators have been proposed for the TSP.The commonly used crossover operator for TSP is Cycle crossover (CX), partially matched crossover (PMX) [4], Ordered crossover (OX).The OX works as follows. the first gene is chosen from one of the parents

P1 = 12345678 P2 = 85213647 say pick 1 from P1

P’ = 1 − − − − − −−

Next every element is picked from one of the parents and place it in the position it was previously in. Since the first position is occupied by 1, the number 8 from v2 cannot go there. So must 8 is picked from P1.

P’ = 1 −−−−−−8

This forces us to put the 7 in position 7 and the 4 in position 4, as in P1.

P’ = 1 − −4 − −78

(4)

parents.[6,7,8]. This is not a problem since it will usually only occur if the parents have high fitness, in which case, it could still be a good choice.

3.1.3 Mutation

Mutation is normally used to restore the lost genetic material and also to introduce population diversity. The main constraint is same as crossover operator that there should not be any repetition of cities in a solution. For TSP the usually used mutation operator is Swapping between two cities, where two cities are chosen randomly and their position is swapped. For example, suppose the chromosome is 1 5 6 2 4 7 8 3 and two randomly generated position is city 6 and city 7 so after swapping it becomes 1 5 7 2 4 6 8 3.Now it may happened that after swapping the cost of the tour may increase.

3.2 Sequential Constructive Crossover

Sequential Constructive Crossover (SCX) is unconventional crossover operator which conserves the good sequential structure of the parent’s chromosomes during creation of new child chromosomes. In this approach the child chromosome are constructed by sequentially choosing the nodes with minimum cost from parent chromosome [12, 13]. The algorithm of SCX is described as follows.

Step 1: Start from 'Node 1’ (i.e., current node p =1).

Step 2: Sequentially search both of the parent chromosomes and consider the first ‘legitimate node' (the node that is not yet visited) appeared after 'node p’ in each parent. If no 'legitimate node' after 'node p’ is present in any of the parent, search sequentially the nodes {2, 3, …, n} and consider the first 'legitimate' node, and go to Step 3.

Step 3: Suppose the 'Node α' and the 'Node β' are found in 1st and 2nd parent respectively, then for selecting the

next node go to Step 4.

Step 4: If Cpα < Cpβ, then select 'Node α', otherwise, 'Node β' as the next node and concatenate it to the partially

constructed offspring chromosome. If the offspring is a complete chromosome, then stop, otherwise, rename the present node as 'Node p' and go to Step 2.

Let us illustrate the SCX through the example given as cost matrix in Table 1. Let a pair of selected chromosomes be P1: (1, 5, 7, 3, 6, 4, 2) and P2: (1, 6, 2, 4, 3, 5, 7) with values 312 and 331 respectively.

Table 1: Cost Matrix

Node 1 2 3 4 5 6 7

1 999 75 99 9 35 63 8

2 51 999 86 46 88 29 20

3 100 5 999 16 28 35 28

4 20 45 11 999 59 53 49

5 86 63 33 65 999 76 72

6 36 53 89 31 21 999 52

7 58 31 43 67 52 60 999

(5)

is accepted and the partially constructed chromosome will be (1, 5, 7). The ‘Legitimate’ node after 'Node 7' in P1 is 'Node 3', but none in P2. So, for P2, the first 'Legitimate' node in the set {2, 3, 4, 5, 6, 7} is considered, that is, 'Node 2'. Since C72 = 31 < 43 = C73, 'Node 2' is accepted. Thus, the partially constructed chromosome will be (1, 5, 7, 2). Again, the ‘Legitimate’ node after 'Node 2' in P1 is none, but in P2 is 'Node 4'. So, for P1, again first 'Legitimate' node is considered in the set {2, 3, 4, 5, 6, 7}, that is, 'Node 3'. Since C24 = 46 < 86 = C23, 'Node 4' is accepted. So, the partially constructed chromosome will be (1, 5, 7, 2, 4). The ‘Legitimate’ node after 'Node 4' in P1 is none, but in P2 is 'Node 3'. So, for P1, The first 'Legitimate' node in the set {2, 3, 4, 5, 6, 7} is considered, that is, 'Node 3'.'Node 3' is accepted, which will lead to the partial chromosome (1, 5, 7, 2, 4, 3). The ‘Legitimate’ node after 'Node 3' in P1 is 'Node 6', but none in P2. So, for P2, First 'Legitimate' node in the set {2, 3, 4, 5, 6, 7} is considered, that is, 'Node 6' and it is accepted. Thus the complete offspring chromosome will be (1, 5, 7, 2, 4, 3, 6) with value 266 which is less than value of both the parent chromosomes. The crossover is shown in Figure 1. The parents are showing as (a) and (b), while (c) is a possible offspring. Parents’ characteristics are inherited mainly by crossover operator. The operator that preserves good characteristics in the offspring is said to be good operator. In SCX the low cost gene sequences of parents are maintained in child chromosome where in OX, as from the previous discussion only the positions of the genes are preserved in child. So, The SCX is excellent in preserving good characteristics of the parents in offspring. As well as it also expected to introduce some new edges to maintain diversity. In the given example Out of seven edges five edges are selected from either of the Parents. That is, 71.4 % of edges are selected from parents. Others are introduced by SCX.

Fig 1: Sequential Constructive Crossover Operator

4. Sequential Constructive Crossover Based Selection (SCXBS)

(6)

thus counter value is not incremented while selecting them. So the counter value for the offspring (1, 5, 7, 2, 4, 3, 6) is 5.

Algorithm for SCX Based Selection:

At first the counter_sum is calculated ( i.e. the summation of counter value of all chromosomes in a population).

1. Calculate the cumulative counter_cusum.

(i.e. counter_cusum[i]=counter[i]+counter[i-1]+counter[i-2]+…….+counter[1].

2. Repeat step 3,4 Until the population is not filled

3. Generate a random number RN between 1 and counter_sum 4. For i=1 to population_size

a. If RN>=counter_cusum[i] then copy i th b. Chromosome to mating_pool.

5. End

Using that selection algorithm, multiple copies (more than one) of good chromosome ( higher counter value),and a few copies of bad chromosome(small counter value) can be selected.

5. Experimental Result And Discussion

The Genetic Algorithms using SCXBS, has been coded in Visual Basic 6 on a Pentium 4 personal computer with speed 3 GHz and 2 GB MB RAM under MS Windows XP, Initial population is generated randomly. The following common parameters are selected for the algorithms: population size is 200, probability of crossover is 1.0 (i.e., 100%), probability of mutation is 0.0667 (i.e., 6.67%).To measure the performance of the proposed SCXBS operator with compare to the Traditional GA (with roulette wheel selection and Ordered crossover operator) the experiment has been done on different no of cities ( 10,20,25,30). For each instance the experiments were performed 5 times. For discussion purpose experimental result of 30 cities has considered. A comprehensive empirical study has been performed on the effects of the proposed unconventional selection Operator SCXBS on the fitness values of the each generation. Each of the case, the use of SCXBS gives quicker convergence towards the optimal solution or near optimal solution with respect to the Traditional GA with conventional operators. Fig2 shows the experimental results, it shows the the nature of the Fitness vs Generations curve.

The aim of this paper is not only to improve the solution quality and to compare the quality of the solutions by SCXBS operators with conventional operators ,the main objective is to show , it is not necessary that the selection criteria would be always the better fitness value directly evaluated by the problem specific fitness function. The alternative selection procedure named as SCXBS, discussed in this paper has the ability to converge the GA to optimal or near optimal solution.

The solution quality is measured by the percentage of excess of solution value above the optimal solution Value from the given formula.

100

(%)

=

×

utionValue

OptimalSol

utionValue

OptimalSol

lue

SolutionVa

Excess

(7)

Fig 2: Fitness vs. Generation

Table 2: Performance Analysis

Generation Fitness Excess(%) Generation Fitness Excess(%)

Traditional GA

SCXBS GA

Traditional GA

SCXBS GA

Traditional GA

SCXBS GA

Traditional GA

SCXBS GA

10 574 496 59.02 37.4 4100 460 408 27.42 13.02

20 543 467 50.41 29.36 4200 459 394 27.15 9.14

50 514 401 42.38 11.08 4300 464 403 28.53 11.63

100 510 431 41.27 19.39 4400 433 361 19.94 0

200 501 408 38.78 13.02 4500 466 376 29.09 4.16

500 477 427 32.13 18.28 4600 470 400 30.19 10.8

700 458 418 26.87 15.79 4700 460 407 27.42 12.74

1000 477 422 32.13 16.9 4800 447 405 23.82 12.19

1200 454 420 25.76 16.34 4900 438 405 21.33 12.19

1500 461 409 27.7 13.3 5000 437 404 21.05 11.91

1700 465 397 28.81 9.97 5100 433 387 19.94 7.2

2000 440 407 21.88 12.74 5200 425 387 17.73 7.2

2200 473 400 31.02 10.8 5300 425 386 17.73 6.93

2500 482 392 33.52 8.59 5400 425 379 17.73 4.99

2700 452 406 25.21 12.47 5500 425 377 17.73 4.43

3000 444 389 22.99 7.76 5600 425 379 17.73 4.99

3200 463 384 28.25 6.37 5700 421 379 16.62 4.99

3500 447 393 23.82 8.86 5800 425 373 17.73 3.32

3700 459 413 27.15 14.4 5900 421 379 16.62 4.99

4000 425 403 17.73 11.63 6000 425 379 17.73 4.99

0 100 200 300 400 500 600 700

0 1000 2000 3000 4000 5000 6000 7000

Fitness

Generation

TRADITIONAL GA

(8)

Here high population size is not set and parallel version of algorithms to obtain exact solution is not considered, as was done by Whitley et al. [7]. Also, highest probability of crossover is used to show the exact nature of crossover operator SCX based on which the selection is made. Mutation with lowest probability is applied just not to get stuck in local minima quickly. It is very difficult to say that what moderate sized instance is unsolvable exactly by proposed selection operator, because, for example, the instance of 100 cities. Could be solved exactly, at least one in ten runs, whereas 30 cities could not be solved within ten runs. So incorporation of a good local search technique to the algorithm that may solve exactly the other instances, which is under investigation.

6. Conclusion

Genetic Algorithm is relatively new optimization techniques which can be applied to various problems of different domain including those are NP-hard.TSP is one such combinatorial optimization and NP-hard problem. So GA can be applied to find the city sequence with optimal travelling cost, that is the solution of TSP. Due to the stochastic nature of GA, it does not ensure an optimal solution always, however it usually gives good approximations (near optimal) in a reasonable amount of time. Therefore, this would be a good algorithm to try on the Traveling Salesman Problem. Genetic algorithm can be explored using different genetic operators for selection, crossover and mutation. However Genetic algorithm depends very much on the way the problem is encoded and which crossover and mutation methods are used. Specifically in this paper motivation for choosing the special unconventional selection and crossover operators, has been discussed with its implementation, its application to a standard benchmark problem i.e. TSP problem. It seems that, the main issue with the Genetic Algorithms to be devised is that it is difficult to maintain structure from the parent chromosomes and still end up with a better and valid solution in the child chromosomes. Here the SCX and the selection based on SCX are trying to achieve this to some extent. This helps to find good near optimal solution. Perhaps a better crossover or mutation routine that retains structure from the parent chromosomes and also gives a better solution than those are previously found, may be introduced .That may be the future work in this area.

References

[1] Zakir H. Ahmed, “Genetic Algorithm for the Traveling Salesman Problem Using Sequential Constructive Crossover Operator”,Journal of Biometrics & Bioinformatics (IJBB) Volume (3): Issue (6) pp.96-105

[2] Goldberg D, "Web Courses", http://www.engr.uiuc.edu/OCEE, 2000.

[3] Genetic Algorithm Solution Of The TSP Avoiding Special Crossover And Mutation- Gokturk Ucoluck.,Department of computer Engineering MiddleEast Technical University,Turkey.

[4] D.E. Goldberg and R. Lingle. “Alleles, Loci and the Travelling Salesman Problem”. In J.J. Grefenstette (ed.) Proceedings of the 1st International Conference on Genetic Algorithms and Their Applications. Lawrence Erlbaum Associates, Hilladale, NJ, 1985.

[5] L. Davis. “Job-shop Scheduling with Genetic Algorithms”. Proceedings of an International Conference on Genetic Algorithms and Their Applications, pp. 136-140, 1985.

[6] I.M. Oliver, D. J. Smith and J.R.C. Holland. “A Study of Permutation Crossover Operators on the Travelling Salesman Problem”. In J.J. Grefenstette (ed.). Genetic Algorithms and Their

[7] Applications: Proceedings of the 2nd International Conference on Genetic Algorithms. Lawrence Erlbaum Associates, Hilladale, NJ, 1987.

[8] I. Choi, S. Kim and H. Kim. "A genetic algorithm with a mixed region search for the asymmetric traveling salesman problem". Computers & Operations Research 30, pp. 773 – 786, 2003.

[9] 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 140, pp. 606-617, 2002.

[10] D.E. Goldberg. "Genetic Algorithms in Search, Optimization, and Machine Learning". Addison- Wesley, New York, 1989.

[11] K. Deb. “Optimization For Engineering Design: Algorithms And Examples”. Prentice Hall Of India Pvt. Ltd., New Delhi, India, 1995. [12] Z.H. Ahmed. "A sequential Constructive Sampling and Related approaches to Combinatorial Optimization". PhD Thesis, Tezpur

University, India, 2000.

[13] Z.H. Ahmed and S.N.N. Pandit. “The travelling salesman problem with precedence constraints”. Opsearch 38, pp. 299-318, 2001. [14] Goldberg D. L., "Genetic Algorithms in Search, Optimization, And Machine Learning", Addison-Wesley, 1989.

Imagem

Table 1: Cost Matrix
Fig 1: Sequential Constructive Crossover Operator

Referências

Documentos relacionados

To find the running time, notice that if η is the number of generations, μ the population size, n the quantity of genes of any chromosome (problem input) and as it is

Gucht, The effects of population size, heuristic crossover and local improvement on a genetic algorithm for the traveling salesman problem, in: Proc. Johnson,

About 100 tests were executed for every possible combination of selection algorithm (Roulette [ROL], Tournament[TOR], Determinist Sampling [DSA], and Stochastic Remainder

In order to reduce the preparation time of tubes machine, the problem is conceived as a Traveling Salesman and later as a Generalized Traveling Salesman, enabling the minimization

% $$|$ thus: the selection operator is used to choose the best individuals from the current population using % } each pair of selected chromosomes, the crossover operator

It can be seen that by having the ROCKS running on Beowulf cluster we can effectively disseminate the tasks through out the cluster thereby performing computation via the

In this paper I have proposed a algorithm to solve TSP using Genetic algorithms (GA) and Memetic algorithms (MA) with the crossover operator Edge Assembly

objective_func_evaluation operator ∆ provides a much efficient approach of reaching an optimal solution by using a simple to implement adaptive repair operator