parallel genetic algorithm for traveling salesman problem ... · parallel genetic algorithm for...

8
Journal of Innovative Technology and Education, Vol. 3, 2016, no. 1, 139-146 HIKARI Ltd, www.m-hikari.com http://dx.doi.org/10.12988/jite.2016.6829 Parallel Genetic Algorithm for Traveling Salesman Problem on Graphic Processing Unit Fitriyani School of Computing Telkom University, Bandung, Indonesia Erqy Sara Quartian School of Computing Telkom University, Bandung, Indonesia Yuliant Sibaroni School of Computing Telkom University, Bandung, Indonesia Fhira Nhita School of Computing Telkom University, Bandung, Indonesia Copyright © 2015 Fitriyani et al. This article is distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. Abstract Travelling Salesman Problem (TSP) Algorithm is classified as high complexity case that frequently occurred in real life. On the other hand, Genetic Algorithm is classified as a robust algorithm to solve complex cases. While having the ability to solve complex cases, Genetic Algorithm has high time complexity. Parallel computation can be applied to increase the performance of a processing unit. In this research, the TSP case will be solved by using the Genetic Algorithm on Graphical Processing Unit (GPU). The experimental result showed that how a genetic algorithm needs lower execution time, larger fitness and optimal mileage. The speedup is 2.65, the shortest distance of parallel implementation is 4739.34, better than serial implementation, and the best fitness is not much different respectively 0.000210 and 0.000211 for serial and parallel. Keywords: parallel computing, genetic algorithm, TSP, CUDA

Upload: lythuy

Post on 09-Sep-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Parallel Genetic Algorithm for Traveling Salesman Problem ... · Parallel genetic algorithm for traveling salesman 141 Genetic Algorithm is also known of its robustness in solving

Journal of Innovative Technology and Education, Vol. 3, 2016, no. 1, 139-146

HIKARI Ltd, www.m-hikari.com http://dx.doi.org/10.12988/jite.2016.6829

Parallel Genetic Algorithm for Traveling Salesman

Problem on Graphic Processing Unit

Fitriyani

School of Computing Telkom University, Bandung, Indonesia

Erqy Sara Quartian

School of Computing Telkom University, Bandung, Indonesia

Yuliant Sibaroni

School of Computing Telkom University, Bandung, Indonesia

Fhira Nhita

School of Computing Telkom University, Bandung, Indonesia

Copyright © 2015 Fitriyani et al. This article is distributed under the Creative Commons

Attribution License, which permits unrestricted use, distribution, and reproduction in any medium,

provided the original work is properly cited.

Abstract

Travelling Salesman Problem (TSP) Algorithm is classified as high complexity

case that frequently occurred in real life. On the other hand, Genetic Algorithm is

classified as a robust algorithm to solve complex cases. While having the ability

to solve complex cases, Genetic Algorithm has high time complexity. Parallel

computation can be applied to increase the performance of a processing unit. In

this research, the TSP case will be solved by using the Genetic Algorithm on

Graphical Processing Unit (GPU). The experimental result showed that how a

genetic algorithm needs lower execution time, larger fitness and optimal mileage.

The speedup is 2.65, the shortest distance of parallel implementation is 4739.34,

better than serial implementation, and the best fitness is not much different

respectively 0.000210 and 0.000211 for serial and parallel.

Keywords: parallel computing, genetic algorithm, TSP, CUDA

Page 2: Parallel Genetic Algorithm for Traveling Salesman Problem ... · Parallel genetic algorithm for traveling salesman 141 Genetic Algorithm is also known of its robustness in solving

140 Fitriyani et al.

1 Introduction

Nowadays, the needs of high performance computing are increasingly fast.

Most of the computational problems need an excessive amount of computing time,

which is inversely proportional with the need to be fast. There are several cases

that require the support of high-performance system, for example: combinatorial

problem (NP-complete), complex modeling and simulation both micro (molecular,

nano material, dynamic fluid, etc) and macro scale, a very detailed animations

with special effects, weather forecast systems that covers whole regions of the

world, etc. The servers of some internet giants like Google and Yahoo also

requires the support of a high-performance systems.

Travelling Salesman Problem (TSP) is considered as a problem with high

complexity or NP-complete. The main problem of TSP is to find the shortest route

from a collection of city, visiting a city exactly once and return to the initial city.

Until now, TSP is still considered as an interesting study in order to find the

fastest time and the best result.

The utilization of GPU in high-complexity computational problem offer an

interesting prospect given the price of GPU is relatively inexpensive while the

numbers of the processors are relatively high. With this condition, the utilization

of GPU in computation becomes very feasible to be developed in the future. In

this research, the TSP case will be solved by implementing the Genetic Algorithm

on GPU with CUDA architecture.

2 Related Work

In its early emergence, the GPU is known as a graphics processor. But the

numbers of processor cores in it attract the researchers to implement it data

computing. A number of studies have been carried are related to GPU utilization

in numeric data computing. Lefonn et al. developed a library to access the GPU

data structures in generic and efficient way [13]. Mendez-Lojo et al. use GPU to

run irregular algorithms that operate on pointer-based data structures as

graphs[14], resulting an average speedup of 7x compared to a sequential CPU

implementation and outperforms a parallel implementation of the same algorithm

running on 16 CPU cores.

The TSP case is frequently studied by the researchers of Yang and Nygard to

observe the impact of genetic algorithm initial population in order to solve the

TSP case by using the approach of time windows by using regular CPU[15].

Some researchers also investigate the TSP case in mathematical pint of view.

Bartal et al. shown the algorithmic tractability ofmetric TSP depends on the

dimensionality of the space and not on its specific geometry [16]. In another TSP

study, Fekete et al. can solve the Fermat-Weber-Problem (FWP) with high

accuracy in order to find a good heuristic solution for the MWMP [17]. Various

algorithms to solve the TSP case can also be applied the way Ant Algorithm is

utilized [5].

Page 3: Parallel Genetic Algorithm for Traveling Salesman Problem ... · Parallel genetic algorithm for traveling salesman 141 Genetic Algorithm is also known of its robustness in solving

Parallel genetic algorithm for traveling salesman 141

Genetic Algorithm is also known of its robustness in solving high-complexity

problems. Some of the application of the Genetic Algorithm can be seen in

weather forecasting [6, 7] and the prediction dengue fever dissemination.

3 Parallel Genetic Algorithm for TSP

TSP is a high-complexity problem or NP-Complete. The idea of TSP is to find

the shortest route from numbers of city, visiting a city exactly once and return to

the initial city. When the numbers of cities are very large, the time complexity of

finding each cost of the route is very high.

Genetic Algorithms produce a solution or a model in the form of chromosomes

or an individual containing genes. The evolution process in Genetic Algorithms

starts the initialization of population or the determination of individual

representation. Then each chromosome will be decoded. After that, each

chromosomes will be evaluated and each parents will be determined. The parents

will produce child from crossover process and mutation. The produced child will

be selected to replace the parents’ chromosomes in the next generation. In Genetic

Algorithms, elitism process will be carried in order to maintain the best individual

that has the best fitness value so that the individual will be included in to the next

generation.

a. Individual Representation

In Genetic Algorithms (GA), biner, real or integer representation can be used to

represent individual/chromosomes. The representation that is used in TSP is

permutation representation, where the value of each gene has to be different

from each other because each gene describes each city that has been visited.

b. Individual Evaluation

Individual evaluation used invers fitness below:

Where:

f = the fitness function

h = sum of path length

a = the smallest value

c. Parents Selection

Parents selection or the selection of two chromosomes in GA depends on

fitness value and uses Roulette-Wheel algorithms where the chromosomes

occupy a portion of the circle corresponding to the value of fitness. The higher

the value of fitness of a chromosome, the portion of the circle that it occupied

will also be larger, so that the chromosome will be larger and will be selected

as parents.

d. Cross-over

The purpose of the cross-over is to produce child from selected parents. Each

Page 4: Parallel Genetic Algorithm for Traveling Salesman Problem ... · Parallel genetic algorithm for traveling salesman 141 Genetic Algorithm is also known of its robustness in solving

142 Fitriyani et al.

parent will produce two child. Order crossover is used in TSP to prevent one

city visited more than once.

5 1 4 2Orang Tua 1 3

3 2 5 1Orang Tua 2 4

Crossover point

5 1 4 3 Anak 12

4 2 5 3 Anak 21

Crossover point

Figure 1 Order Cross-over example

The probability of cross-over in GA is determined by the Probability of

cross-over (Pc). The interval of the Pc that often used is 0.6 to 0.9[12]. The

random value of Pc is smaller than determined Pc resulting cross-over in the

selected point.

e. Mutation

In GA, the mutation is independent. Mutation in a gene will not induce a

mutation to another gene. As well as cross-over, mutation is also determined

by probability of mutation (Pm). A random value will be generated for each

gene in the chromosomes. If the value of each gene is lower than Pm or higher

than Pm, or between intervals [0..1], the gene that initially has the value of 0

will be changed to 1 and the other way around. On the other hand, a gene with

the value of real numbers will get another random value.

f. Survivor Selection

After going through an evaluation process by using feed forward algorithms

that will produce the best individual, and parents selection process by using

roulette-wheel that will produce the parents, each pair parents will have to

undergo recombination and producing two child. The individual that were

produced through recombination will be going through mutation. The amount

of individual that were produced after the mutation took place will be the same

amount of the amount of initial population. The individuals will replace the

previous generation.

Genetic Algorithm is very effective to solve many problems. But this algorithm

needs an excessive amount of execution time because in the same time every

solution candidate has to be evaluated to the point it reach the desired

performance standard [11]. In the aspect of transportation, genetic algorithm has

been shown to resolve various problems that are considered complex. [1, 12]. In

his research, Chakroborty used genetic algorithms to resolve an Optimal Routing

and Scheduling problem in the field of transportation. In the other research, Vidall

et al. (2011) used a hybrid genetic algorithm to solve multi depot and periodic

vehicle routing problem with a satisfaction result. Genetic algorithm have also

been used in parallel Pospichal et al. (2011) to parallelize the genetic algorithm in

GPU environment using CUDA library. Thera are several model in parallelizing

GA, among others

Parent 1

Parent 2

Child 1

Child 2

Page 5: Parallel Genetic Algorithm for Traveling Salesman Problem ... · Parallel genetic algorithm for traveling salesman 141 Genetic Algorithm is also known of its robustness in solving

Parallel genetic algorithm for traveling salesman 143

4 Experiment and Result

Parallel Genetic Algorithms for TSP are implemented in GPU Geforce

GTX 770, Cuda 7.0 with the compute capability 3.0. TSP data that were being

used has been taken from city TSPLIB 101, by replacing the following parameter:

a. Maximum Generation: 100

b. Population size: 100, 150, 200 and 250

c. The probability used in cross-over phase: 0.5, 0.7, and 0.9

d. The probability used in mutation phase: 0.5, 0.3, and 0.1

Parallel implementation carried out in individual evaluation phase

By observing the parameters above, will be obtained serial execution results as

can be seen in Table 1

Tablel 1. Serial Results Population

Size

Crossover

Probability

Mutation

Probability

Path

length

Fitness Fitness

Average

Time (s)

200 0.9 0.5 4852.61 0.000206 0.000194 2.78

0.3 4833.26 0.000207 0.000187 2.74

0.1 4836.49 0.000207 0.000191 2.77

0.7 0.5 4856.81 0.000206 0.000193 2.72

0.3 4759.60 0.000210 0.000194 2.76

0.1 4902.11 0.000204 0.000185 2.89

0.5 0.5 4847.36 0.000207 0.000191 2.82

0.3 4794.60 0.000209 0.000195 2.68

0.1 4858.35 0.000206 0.000188 2.91

From the Table 1 it could conclude that the best generation can be found in the

population size 200, Pc = 0.7 and Pm = 0.3, the shortest distance of 4759,60 and

the best fitness of 0,000210 with execution time of 2.76 seconds. The parallel

execution can be seen in the following table.

Table 2. Parallel Results

Popula

tion Size

Crossover

Probability

Mutation

Probability

Path

length

Fitness Fitness

Average

Time (s)

150

0.9

0.5 4739.34 0.000211 0.000187 1.04

0.3 4797.78 0.000199 0.000195 1.03

0.1 4917.11 0.000205 0.000197 0.72

0.7

0.5 4889.35 0.000206 0.000193 1.00

0.3 4822.92 0.000204 0.000194 1.19

0.1 4852.58 0.000208 0.000193 1.03

0.5

0.5 4795.98 0.000210 0.000189 1.04

0.3 4873.57 0.000207 0.000197 1.20

0.1 4864.20 0.000207 0.000192 1.02

Page 6: Parallel Genetic Algorithm for Traveling Salesman Problem ... · Parallel genetic algorithm for traveling salesman 141 Genetic Algorithm is also known of its robustness in solving

144 Fitriyani et al.

In Table 2, it can be obtained that the shortest distance for the best generation

can be found in population 150, Pc = 0.9 and Pm = 0.5, shortest distance of

4739.34 and best fitness of 0.000211 with execution time of 1.04 seconds.

Figure 2 Execution Time Serial vs Parallel

Based on the results of serial and parallel implementation shown that the

execution time required for parallel implementation is lower than execution time

for serial implementation by speedup 2.65, see Figure 2 above. Speed up depends

on the design of parallel algorithms and parallel proportion in an algorithm.

Speedup result in this experiment show that the parallel algorithm design is good

enough. Speed up can be improved with better algorithms design and enlarge

parallel proportion in an algorithm. And the shortest distance of parallel

implementation is 4739.34, better than serial implementation. But the best fitness

is not much different respectively 0.000210 and 0.000211, see Table 3 below.

Table 3 Parameter Comparison

Parameter Serial Parallel

Population size 200 150

Pc (crossover) 0.7 0.9

Pm

(mutation) 0.3 0.5

the shortest distance 4759,60 4739.34

the best fitness 0.000210 0.000211

5 Conclusion

The result of the observation in the algorithm implementation in serial and

parallel shows that the higher the fitness value, the shorter the mileage of the TSP.

Probability of cross-over parameter will also affect the result obtained, because

the function of the cross-over is to cross-over between both parents to produce

child that are better than the parents. The lower the probabilities, the more likely

Page 7: Parallel Genetic Algorithm for Traveling Salesman Problem ... · Parallel genetic algorithm for traveling salesman 141 Genetic Algorithm is also known of its robustness in solving

Parallel genetic algorithm for traveling salesman 145

the child would not develop into a better individual in the next iteration.

The result of the parallel and serial execution shows that the implementation of

parallel resulting less computing time and more optimal distance.

References

[1] Partha Chakroborty, Optimal Routing and Scheduling in Transportation:

Using Genetic Algorithm to Solve Difficult Optimization Problems,

Direction IITK Newsletter, 6 (2004), 29-40.

[2] Kevin Dowd, Charles Severance, High Performance Computing, O'Reilly,

2nd edition, 1998.

[3] Dimitri P. Bertsekas, John N. Tsitsiklis, Parallel and Distributed Computing:

Numerical Methods, Prentice-Hall Int. Ed.

[4] A. Grama, A. Gupta, G. Karypis, V. Kumar, Introduction to Parallel

Computing, 2nd Edition, Addison-Wesley, 2003.

[5] Fitriyani, Izzatul Ummah, A Research On Parallel Computing Using Ant

Colony Optimization Algorithm To Distribute Jobs Among Processors In

The System Environment, Proceeding, The 7th International Conference on

Information and Communication Technology and Systems (ICTS), (2013).

[6] F. Nhita, Adiwijaya, Rainfall Prediction using Fuzzy System based on

Genetic Algorithm, Proceeding, International Conference of Information

and Communication Technology (ICoICT), (2013).

[7] F. Nhita, Adiwijaya, U.N. Wisesty, A Forecasting of Weather Data in

Indonesia Using Evolving Neural Network based on Genetic Algorithm,

Proceeding, Seminar Technological Advances in Electrical, Electronics and

Computer Engineering (TAEECE), (2014).

[8] F. Nhita, T. Houw Liong, Shaufiah, The Prediction of Dengue Haemorragic

Fever (DHF) In Cimahi by using Hybrid Genetic Algorithm and Fuzzy

Logic, Jurnal Penelitian dan Pengembangan Telekomunikasi (JURTEL),

(2011).

[9] Nugraha, Eko Mursito Budi, Estiyanti Ekawati, Perancangan Material Nano

Menggunakan Komputasi Kinerja Tinggi, Riset Hibah Bersaing, 2009.

[10] Suyanto, Soft Computing: Membangun Mesin Ber-IQ Tinggi, Bandung,

Informatika, 2008.

Page 8: Parallel Genetic Algorithm for Traveling Salesman Problem ... · Parallel genetic algorithm for traveling salesman 141 Genetic Algorithm is also known of its robustness in solving

146 Fitriyani et al.

[11] P. Pospichal, J. Jaros, J. Schwarz, Parallel Genetic Algorithm on the CUDA

Architecture, Chapter in Applications of Evolutionary Computation, Springer

Berlin Heidelberg, 2010, 442-451.

http://dx.doi.org/10.1007/978-3-642-12239-2_46

[12] T. Vidal, T. Crainic, M. Gendreau, N. Lahrichi, W. Rei, A hybrid genetic

algorithm for multy-depot and periodic vehicle routing problem,

CIRRELT-2011-05, (2011).

[13] A. E. Lefohn, S. Sengupta, J. O. E. Kniss, R. Strzodka, J. D. Owens, Glift:

Generic, Efficient , Random-Access GPU Data Structures, ACM Trans.

Graph., 25 (2006), no. 1, 60-99. http://dx.doi.org/10.1145/1122501.1122505

[14] M. Mendez-Lojo, M. Burtscher, K. Pingali, A GPU Implementation of

Inclusion-based Points-to Analysis, ACM SIGPLAN Notices, 47 (2012),

107-116. http://dx.doi.org/10.1145/2370036.2145831

[15] C.-H. Yang and K. E. Nygard, The Effects of Initial for Time Constrained

Population Traveling in Genetic Search Salesman Problems, ACM, (1993),

378-383.

[16] Y. Bartal, L.-A. Gottlieb, R. Krauthgamer, The Traveling Salesman Problem:

Low-dimensionality implies a polynomial time approximation scheme,

Proceedings of the 44th symposium on Theory of Computing - STOC '12,

(2012), 663-672. http://dx.doi.org/10.1145/2213977.2214038

[17] P. Fekete, H. Meijer, Andre Rohe, W. Tietze, Solving a “Hard” Problem to

Approximate an “Easy” One: Heuristics for Maximum Matchings and

Maximum Traveling Salesman Problems, Chapter in Algorithm Engineering

and Experimentation, Springer Berlin Heidelberg, 2001.

http://dx.doi.org/10.1007/3-540-44808-x_1

Received: November 15, 2015; Published: August 29, 2016