IE538 : Genetic Algorithms and Tabu search Term Project : Traveling Salesman Problem (TSP) – Final presentation GA & TSP - KJ.Kim, M.Buil
Contents • Description of the problem • Results - Comparison of ERX/SXX and EAX/SXX • Description of the project • Discussion/Further improvements • Fitness function • Conclusion • Operators • References • Various criteria • Algorithm diagrams • Results - ERX • Results - SXX • Results - ERX changing with SXX • Results - SXX changing with ERX GA & TSP - KJ.Kim, M.Buil 2
Description of the Problem • Problem simple to state • Shortest route to visit a collection of cities and return to the starting point (minimization problem) • Well-known NP-hard combinatorial optimization problem • GAs are global search algorithms for problems with huge search spaces such as the TSP • Parameters generally consist of given number of cities and their relative distances to each other GA & TSP - KJ.Kim, M.Buil 3
Description of the Project Shortest length: 735x π = 2309 • Search Area of 540,000 km 2 (like France) • 100 cities, spread out on a circle (to check our results) • Initial information given : matrix of distances between every pair cities • We want to compare two crossover operators : � Edge Recombination Crossover � Sub-tour Exchange Crossover (SXX works best with high-fitness sub-tours. ERX can find good local solutions.) • In two cases: � Cities are spread out in a circle (so that we can check the results) � Cities are spread out randomly (so that we can check the robustness of the operators) GA & TSP - KJ.Kim, M.Buil 4
Fitness Function • Our problem is a minimization problem. • We have to maximize the following fitness function : If g(x) < C max , = 0 Otherwise Where n: total number of cities Xi: city number in position I D(Xi , Xj ): distance from Xi to Xj Cmax: Sum of all values of our distance matrix (naïve upper bound) • Also, we assume that our problem is symmetric in distance, so that : D(Xi , Xj ) = D(Xj , Xi ) GA & TSP - KJ.Kim, M.Buil 5
Operators • Selection operator � Binary tournament • Changing Crossover operator (CXO) � ERX to SXX � SXX to ERX • Crossover operator � ERX � SXX • Mutation operator � Swap each city in the string with another with the mutation probability GA & TSP - KJ.Kim, M.Buil 6
Operators - Edge Recombination Crossover • Requires that the number of edges inherited from both parents be as large as possible edge (7 6) or (6 7) Ex: Available edges Algorithm Parent 1 : (1 2 3 4 5 6 7 8 9) City 1: (1 9), (1 2), (1 4) - Choose the start city with the smallest Parent 2 : (4 1 2 8 7 6 9 3 5) City 2: (2 1), (2 3), (2 8) number of edges … - Select next city which City 8: (8 7), (8 9), (8 2) has smallest number of City 9: (9 8), (9 1), (9 6), (9 3) available edges. - Continue Parents d(1 9) = d(9 1) In this algorithm, the resulting path is (1 4 5 6 7 8 2 3 9) • Smallest number of edges criterion � Selecting the city with the smallest number of edges maximizes the probability that you will finish the tour using the parental set of edges � From previous studies experiments, failure occurs in less than 1.5% of the cases with this GA & TSP - KJ.Kim, M.Buil 7 criterion
Operators - Sub-tour Exchange Crossover • Sub-tours S1 and S2 are sub-paths of parent tour 1 and 2 respectively • Algorithm � Select two strings randomly � For one string, randomly select a starting site and a length � For all genes (cities) in sub-path 1, determine sub-path 2, consisting of the same cities � From these two first strings, the two sub-paths and the two reverse-order-sub-paths, 4 children can result of crossover � Fitness of all 4 children is calculated, and the two with higher fitness are selected Ex: Parent 1 : (1 2 3 4 5) sub-path 1: 3 4 5 reverse-order-sub-path 1: 5 4 3 Parent 2 : (2 4 1 5 3) sub-path 2: 4 5 3 reverse order sub-path 2: 3 5 4 4 children: 1 2 4 5 3 (string 1, s2) 1 2 3 5 4 (string 1, rs2) 2 3 1 4 5 (string 2, s1) 2 5 1 4 3 (string 2, rs1) GA & TSP - KJ.Kim, M.Buil 8
Operators - Mutation • Mutation is actually done at the same time as crossover, on each new string created in the new pool. • Our mutation operator consists in swapping the gene in successive positions (1st position, 2nd position, 3rd, etc), according to the probability of mutation, with another gene, selected randomly. • Algorithm: Consider a chromosome of n genes (n cities) � Take gene in 1 st position: test the probability of swapping with Pm � If swap=true, then swap the gene with another random gene (2 nd , 3 rd , …, n th ) � Move to next position, and redo the above process � Continue, until the nth gene is reached • Example: string (1 2 3 4 5) � Take gene in 1 st position: assume swap=true, and the random gene is the 4 th one. � The new string is (4 2 3 1 5) � Move to next position, and redo the above process. Assume swapping is done with the gene in 1 st position, than the new string is (2 4 3 1 5) � Continue, until the 5 th gene is reached GA & TSP - KJ.Kim, M.Buil 9
Various Criteria • Chromosome Representation : Each gene represents a city number � the length of the string is equal to the total number of cities • Initial Population : 100 • Cmax: 4,679,300 • Crossover probability : 0.8 • Mutation probability : 0.0005 • In case of changing operators: change is set as when the last 10 generations have similar average distances - calculated by or if the best so far is the same for the last 50 generations. ㅡ ㅡ We consider there is similarity in average distances when in the last 10 generations 0.999 ≤ r ≤ 1.001 • Termination Criteria : Termination is set as when the population reaches 1,000 generations GA & TSP - KJ.Kim, M.Buil 10
Algorithm diagram - 1 (Without changing operators) GA & TSP - KJ.Kim, M.Buil 11
Algorithm diagram - 2 (With changing operators) GA & TSP - KJ.Kim, M.Buil 12
Algorithm diagram - 3 (With changing operators) GA & TSP - KJ.Kim, M.Buil 13
Results - ERX - 1 • Evolution of average fitness after 1,000 generations & 25 runs: • Average fitness after 1,000 generations: 4,641,801 • Best fitness after 1,000 generations: 4,651,952 GA & TSP - KJ.Kim, M.Buil 14
Results - ERX - 2 • Evolution of path distance after 1,000 generations & 25 runs: • Overall fastest generation at which the overall best string is found: T = 585 • Overall shortest path at generation 1,000: 27,348 GA & TSP - KJ.Kim, M.Buil 15
Results - ERX - 3 • Representation of the best string found in 1,000 generations and 25 runs: GA & TSP - KJ.Kim, M.Buil 16
Results - SXX - 1 • Evolution of average fitness after 1,000 generations & 25 runs: • Average fitness after 1,000 generations: 4,675,462 • Best fitness after 1,000 generations: 4,676,862 GA & TSP - KJ.Kim, M.Buil 17
Results - SXX - 2 • Evolution of average path distance after 1,000 generations & 25 runs: • Overall fastest generation at which the overall best string is found: T = 832 • Overall shortest path at generation 1,000: 2,438 (which is not the best that can be found - 2,309 - but close) GA & TSP - KJ.Kim, M.Buil 18
Results - SXX - 3 • Representation of the best string found in 1,000 generations and 25 runs: 81~96 - 98 - 97 - 99~39 - 41 - 40 - 42~53 - 55 - 54 - 56~80 GA & TSP - KJ.Kim, M.Buil 19
Results - ERX changing with SXX - 1 • Evolution of average fitness after 1,000 generations & 25 runs: Average first convergence - change of operators from ERX to SXX • Average fitness after 1,000 generations: 4,675,482 • Best fitness after 1,000 generations: 4,676,770 GA & TSP - KJ.Kim, M.Buil 20
Results - ERX changing with SXX - 2 • Evolution of average path distance after 1,000 generations & 25 runs: • Average generation of operators’ change: T = 107 • Average length of path at the generation of operators’ change: about 29,000 • Overall fastest generation at which the overall best string is found: T = 908 • Overall shortest path at generation 1,000: 2530 GA & TSP - KJ.Kim, M.Buil 21
Results - ERX changing with SXX - 3 • Representation of the best string found in 1,000 generations and 25 runs: 70~96-35-98-0-99-1~10-12-11-13~20-22-21-23-25-24-26-27-29-28-30~34-97-36~69 GA & TSP - KJ.Kim, M.Buil 22
Results - SXX changing with ERX - 1 • Evolution of average fitness after 1,000 generations & 25 runs: • Average fitness after 1,000 generations: 4,673,417 • Best fitness after 1,000 generations: 4,676,402 GA & TSP - KJ.Kim, M.Buil 23
Results - SXX changing with ERX - 2 • Evolution of average path distance after 1,000 generations & 25 runs: • Average generation of operators’ change: T = 543 • Average length of path at the generation of operators’ change: about 4,440 • Overall fastest generation at which the overall best string is found: T = 946 • Overall shortest path at generation 1,000: 2,898 GA & TSP - KJ.Kim, M.Buil 24
Results - SXX changing with ERX - 3 • Representation of the best string found in 1,000 generations and 25 runs: 76~81-83-82-84-86-85-87~96-98-97-99-0-2-1-3~42-44-43-45~54-56-55-58-57-59-61-60-62~65-69-68- 67-66-70-72-71-74-73-75 GA & TSP - KJ.Kim, M.Buil 25
Recommend
More recommend