Research Article
Developing Programming Tools to Handle Traveling Salesman Problem by the Three Object-Oriented Languages
| 1 Create population of random tours; | | //First storey is GA and increases tours’ quality. It uses IGX as its crossover [5]. | | 2 Use steady-state GA by heuristic crossover to improve population; | | 3 Sort population according to cost in ascendant order; | | 4 Tour best-so-far population0; | | //Second storey is HGA and uses GSX as its crossover, Double-Bridge as its mutation and LK | | as its LS. | | 5 for (i = 1; i <= gen-size; i++) | | 6 { | | 7 Tour child; | | 8 int index; | | 9 if(rand_01() < crossover-rate) | | 10 { | | 11 index = linear selection from population; | | 12 father population[index]; | | 13 index = linear selection from population; | | 14 mother population[index]; | | 15 crossover(father, mother, child); | | 16 Improve child by lk; | | 17 } | | 18 else | | 19 { | | 20 child linear selection from population; | | 21 mutate child by double-bridge; | | 22 Improve child by lk; | | 23 } | | 24 Sort population according to cost in ascendant order; | | 25 if (i % period == 0) | | 26 update candidate set according to edges density in population; | | (27) if(best-so-far cost > population0 cost) | | (28) best-so-far cost population0; | | (29) } | | (30) Report best-so-far; |
|