13.07.2015 Views

A Fast TSP Solver Using GA on JAVA - Gcd.org

A Fast TSP Solver Using GA on JAVA - Gcd.org

A Fast TSP Solver Using GA on JAVA - Gcd.org

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2.1 Mutati<strong>on</strong> by 2optThe 2opt method is <strong>on</strong>e of the most well-known localsearch algorithms am<strong>on</strong>g <str<strong>on</strong>g>TSP</str<strong>on</strong>g> solving algorithms.It improves the tour edge by edge and reverses the orderof the subtour. For example, imagine a tour asshown in the upper part of Fig. 1. Remove the twoedges ab and cd, and reverse the order of the subtour(from b to c), and add the two edges ac and bd. Thisgives us a tour as shown in the lower part of Fig. 1.The lower tour is shorter than the upper <strong>on</strong>e becauseab + cd > ac + bd.tour lengthcrossoverchildtourFigure 2: Pop-up from local minima.adcbg =(D; H; B; A; C; F; G; E) means that the salespers<strong>on</strong>visits towns D, H, B, A, ..., E, successively, andreturns to town D.adFigure 1: The 2opt methodWe check every pair of edges, for example, ab andcd. Ifab + cd > ac + bd holds, we improve them in thesame way as shown in Fig. 1. Actually, ifbothac > aband bd > cd hold, then it is not necessary to check theedges. Therefore we can skip the pairs whose edgesare far away from each other.We repeat the procedures described above until nofurther improvement can be made.2.2 Crossover in Multiplicati<strong>on</strong>When we apply the 2opt method to a soluti<strong>on</strong>, thesoluti<strong>on</strong> often falls into a local minimum. Then it cannotbe improved further by the 2opt method. C<strong>on</strong>sidertwo soluti<strong>on</strong>s that have fallen into dierent localminima. Potentially, each soluti<strong>on</strong> may have the bestsubtour for a dierent part of the tour. Then, we canmake a better soluti<strong>on</strong> if we combine those best subtoursappropriately. We cannot say, of course, whichof the subtours are good, but after many trials, we canexpect ospring soluti<strong>on</strong>s to be located in the valleyof the global minimum as shown in Fig. 2.We propose a new crossover operator that acquiresthe l<strong>on</strong>gest possible sequence of parents' subtours.We named it `Greedy Subtour Crossover (GSX)'. Weshowed[3] by experiments that using the GSX, the soluti<strong>on</strong>can pop up from local minima more eectivelythan by using simulated annealing (SA) methods.In the GSX, we use the path representati<strong>on</strong> fora genetic coding. For example, the chromosomecbParentsPick up alphabets from the parents alternately.D H B A C F G EB C D G H F E AH B A C D GChildFigure 3: Greedy Subtour CrossoverAdd the rest of alphabetsin the random order.F EAlgorithm: Greedy Subtour CrossoverInputs: Chromosomes g a = (a 0 ;a 1 ;:::;a n01) andg b =(b 0 ;b 1 ;:::;b n01).Outputs: The ospring chromosome g.procedure crossover(g a ,g b ) ff a truef b truechoose town t randomlychoose x, where a x = tchoose y, where b y = tg tdo fx x 0 1 (mod n),y y +1 (mod n).if f a = true then fif a x 62 g then fg a x 1 g,g else ff a false.ggif f b = true then fif b y 62 g then fg g 1 b y ,g else f

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!