solution of traveling salesman problem on scx based ...

1 downloads 0 Views 112KB Size Report
JIS College of Engineering, WBUT. Kalyani ... B. C. Roy Engineering College ,WBUT ..... [2] Goldberg D, "Web Courses", http://www.engr.uiuc.edu/OCEE, 2000.
Sourav Samanta et al. / International Journal of Engineering Science and Technology (IJEST)

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 [email protected]

ANWESHA DE Department Of Computer Science & Engineering DR. B. C. Roy Engineering College ,WBUT Durgapur, 713206, Burdwan,Westbengal,India [email protected]

SATRUGHNA SINGHA Department Of Computer Science & Engineering JIS College of Engineering, WBUT Kalyani, 741235, Nadia,West Bengal, India [email protected]

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

In the Computer Science literature Traveling Sales Man Problem is one of the eminent NP-Complete [2] problem. There are mainly three reasons why TSP has been attracted the attention of many researcher’s and remains an active research area. First, a large number of real-world problems can be modeled by TSP. Second, it was proved to be NP-Complete problem [3]. Third, NP-Complete problems are intractable in the sense that no

ISSN : 0975-5462

Vol. 3 No. 8 August 2011

6622

Sourav Samanta et al. / International Journal of Engineering Science and Technology (IJEST)

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

It is essential to modify the Genetic Algorithm when it is used to solve any specific problem .This modification is basically done in the Encoding Method and GA operator (Selection ,Crossover, Mutation).The way of encoding technique and selection ,crossover, mutation process vary problem to problem, still basic logic

ISSN : 0975-5462

Vol. 3 No. 8 August 2011

6623

Sourav Samanta et al. / International Journal of Engineering Science and Technology (IJEST)

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 Since the same set of positions is occupied by 1, 4, 7, 8 in P1 and P2, we finish by filling in the blank positions with the elements of those positions in P2. Thus P’ = 15243678 , and P’’ is calculated from the complement of P’ . So P’’ =82315647. Here the positions of the genes in the child chromosome are same with any of the parents, but the gene sequence may not be always same with parents. This process ensures that each chromosome is legal. Notice that it is possible for us to end up with the offspring being the same as the

ISSN : 0975-5462

Vol. 3 No. 8 August 2011

6624

Sourav Samanta et al. / International Journal of Engineering Science and Technology (IJEST)

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

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

1

Select 'Node 1' as the 1st gene. The ‘Legitimate’ nodes after 'Node 1' in P1 and P2 are 'Node 5' and 'Node 6' respectively with C15=35 and C16=63. Since C15< C16, 'Node 5' is selected .So, the partially constructed chromosome will be (1, 5). The ‘Legitimate’ node after 'Node 5' in both P1 and P2 is 'Node 7'. So, the 'Node 7',

ISSN : 0975-5462

Vol. 3 No. 8 August 2011

6625

Sourav Samanta et al. / International Journal of Engineering Science and Technology (IJEST)

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)

A new approach has been introduced for selection which is based on sequential constructive crossover (SCX) named as SCXBS. During each successive generation, a proportion of the existing population is selected to rise a new generation. In the case of selection individual solutions are selected through a fitness-based process, where fitter solutions (as measured by a fitness function) are typically more likely to be selected. In SCXBS a particular chromosome is selected for next generation, if it is inheriting its parent’s low cost gene sequences as described by SCX and thus producing less cost. So the probability of a particular solution to be selected depends on the cost of the tour and also how much that particular solution is maintaining its parent chromosome structure. In the proposed method a counter (typically integer value) is maintained for each solution when it is created from its parent solution .The counter value for each solution(chromosome) indicates how much times we can copy the Next 'legitimate node' with minimum cost from the parent chromosome to the partially constructed solution without any conflict.. Then select the individuals for mating based on their counter value with the hope that a particular individual with a large counter value indicates that we are taking the next 'Legitimate Node' with minimum cost more times for that particular chromosome ,thus it is producing a better solution with less cost while maintaining parent’s structure. In the previous example the counter value for the offspring is incremented by 1 while selecting node 5 and 7 , 2, 4,3 only, for the rest of the nodes ,mainly to avoid the repetition ,there is actually no choice to take the next node from parents structure with minimum cost,

ISSN : 0975-5462

Vol. 3 No. 8 August 2011

6626

Sourav Samanta et al. / International Journal of Engineering Science and Technology (IJEST)

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 population).

is calculated ( i.e. the summation of counter value of all chromosomes in a

1.

Calculate the cumulative counter_cusum.

2. 3. 4.

Repeat step 3,4 Until the population is not filled Generate a random number RN between 1 and counter_sum For i=1 to population_size a. If RN>=counter_cusum[i] then copy i th b. Chromosome to mating_pool. End

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

5.

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.

Excess(%) =

SolutionValue − OptimalSolutionValue × 100 OptimalSolutionValue

Percentage of excess of solution value over the optimal solution value of 5 runs by the proposed algorithm. It is to be noted that here only the Traditional GA has been implemented with conventional Operator and GA with SCXBS operator for the comparative study. The percentage of excess of solution value above the optimal solution value for the traditional GA and GA with SCXBS both is shown in Table 2. On the basis of quality of the solution, as a whole, for all the instances of GA with SCXBS is giving more near optimum solution than the solution obtained by Traditional GA for any generation. So in terms of quality of the solution, for any generation, GA with SCXBS is found to be better than Traditional GA.

ISSN : 0975-5462

Vol. 3 No. 8 August 2011

6627

Sourav Samanta et al. / International Journal of Engineering Science and Technology (IJEST)

700

TRADITIONAL GA

600

SCXBS GA

Fitness

500

400

300

200

100

0 0

1000

2000

3000

4000

5000

6000

7000

Generation Fig 2: Fitness vs. Generation Table 2: Performance Analysis Generation

10 20 50 100 200 500 700 1000 1200 1500 1700 2000 2200 2500 2700 3000 3200 3500 3700 4000

Fitness

Excess(%)

Traditional GA

SCXBS GA

Traditional GA

SCXBS GA

574 543 514 510 501 477 458 477 454 461 465 440 473 482 452 444 463 447 459 425

496 467 401 431 408 427 418 422 420 409 397 407 400 392 406 389 384 393 413 403

59.02 50.41 42.38 41.27 38.78 32.13 26.87 32.13 25.76 27.7 28.81 21.88 31.02 33.52 25.21 22.99 28.25 23.82 27.15 17.73

37.4 29.36 11.08 19.39 13.02 18.28 15.79 16.9 16.34 13.3 9.97 12.74 10.8 8.59 12.47 7.76 6.37 8.86 14.4 11.63

ISSN : 0975-5462

Generation

4100 4200 4300 4400 4500 4600 4700 4800 4900 5000 5100 5200 5300 5400 5500 5600 5700 5800 5900 6000

Vol. 3 No. 8 August 2011

Fitness

Excess(%)

Traditional GA

SCXBS GA

Traditional GA

SCXBS GA

460 459 464 433 466 470 460 447 438 437 433 425 425 425 425 425 421 425 421 425

408 394 403 361 376 400 407 405 405 404 387 387 386 379 377 379 379 373 379 379

27.42 27.15 28.53 19.94 29.09 30.19 27.42 23.82 21.33 21.05 19.94 17.73 17.73 17.73 17.73 17.73 16.62 17.73 16.62 17.73

13.02 9.14 11.63 0 4.16 10.8 12.74 12.19 12.19 11.91 7.2 7.2 6.93 4.99 4.43 4.99 4.99 3.32 4.99 4.99

6628

Sourav Samanta et al. / International Journal of Engineering Science and Technology (IJEST)

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] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]

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 Goldberg D, "Web Courses", http://www.engr.uiuc.edu/OCEE, 2000. Genetic Algorithm Solution Of The TSP Avoiding Special Crossover And Mutation- Gokturk Ucoluck.,Department of computer Engineering MiddleEast Technical University,Turkey. 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. L. Davis. “Job-shop Scheduling with Genetic Algorithms”. Proceedings of an International Conference on Genetic Algorithms and Their Applications, pp. 136-140, 1985. 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 Applications: Proceedings of the 2nd International Conference on Genetic Algorithms. Lawrence Erlbaum Associates, Hilladale, NJ, 1987. 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. 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. D.E. Goldberg. "Genetic Algorithms in Search, Optimization, and Machine Learning". Addison- Wesley, New York, 1989. K. Deb. “Optimization For Engineering Design: Algorithms And Examples”. Prentice Hall Of India Pvt. Ltd., New Delhi, India, 1995. Z.H. Ahmed. "A sequential Constructive Sampling and Related approaches to Combinatorial Optimization". PhD Thesis, Tezpur University, India, 2000. Z.H. Ahmed and S.N.N. Pandit. “The travelling salesman problem with precedence constraints”. Opsearch 38, pp. 299-318, 2001. Goldberg D. L., "Genetic Algorithms in Search, Optimization, And Machine Learning", Addison-Wesley, 1989. Satrughna Singha, Tanmay Bhattacharya, S.R. Bhadra Chaudhuri, "An Approach for Reducing Crosstalk in Restricted Channel Routing Using Graph Coloring Problem and Genetic Algorithm," iccee, pp.807-811, 2008 International Conference on Computer and Electrical Engineering, 2008

ISSN : 0975-5462

Vol. 3 No. 8 August 2011

6629

Suggest Documents