390 likes | 504 Views
Paulo Lafeta Ferreira Introduction to Artificial Intelligence – CS 581 Professor: Pushpak Karnick. Genetic Algorithms with Multiple Crossovers on Traveling Salesman Problem. Introduction to Traveling Salesman Problem (TSP).
E N D
Paulo Lafeta Ferreira Introduction to Artificial Intelligence – CS 581Professor: Pushpak Karnick Genetic Algorithms with Multiple Crossovers on Traveling Salesman Problem
Introduction to Traveling Salesman Problem (TSP) • “Traveling Salesman” must visit each city exactly once and then return back to the starting point. • Complexity of the problem (NP-hard) grows exponentially. • Approximate solutions can be made using Genetic Algorithms.
Djibouti Map: 89 cities: http://www.tsp.gatech.edu
Djibouti Optimal solution found. Path size: 351 mi
National TSPs: Argentina Map: 9,152 Cities:
National TSPs: Argentina Path size found: 44,232 mi Solution non-optimal. Path found is at maximum, 0.012% greater than optimum solution.
China Map:
China 71,009 cities:
China Best path found in a recent test:
China Path size: 241,188 mi 0.024% near optimal solution
World Tour • This problem has 1,904,711 cities from around the world.
World Tour Best path found: 396,967,677 mi 0.04996% greater than optimal path.
Bigger National TSP solved Sweden: • 24,978 cities • Path size: 45,049 mi • Used 96 clusters dual Intel Xeon 2.8 Ghz • Time running: approximately 3 years • In an usual computer: ~84 years
Crossovers implemented • Adjacency • Crossovers: • Alternating Edges • Subtour-chunks • Heuristic • Path • Crossovers: • Partially Mapped (PMX) • Order (OX) • Cycle (CX) • Ordinal • Crossover: • Cut-and-splice
Path crossovers • Partially Mapped crossover (PMX): p1 = [1 2 3 | 4 5 6 7 | 8 9] and p2 = [4 5 2 | 1 8 7 6 | 9 3]o1 = [x x x | 1 8 7 6 | x x] and o2 = [x x x | 4 5 6 7 | x x]o1 = [x 2 3 | 1 8 7 6 | x 9] and o2 = [x x 2 | 4 5 6 7 | 9 3]
Path crossovers • Order crossover (OX): p1 = [1 2 3 | 4 5 6 7 | 8 9] and p2 = [4 5 2 | 1 8 7 6 | 9 3] • o1 = [x xx | 4 5 6 7 | x x] and • o2 = [x x x | 1 8 7 6 | x x] • o1 = [2 1 8 | 4 5 6 7 | 9 3] • o2 = [3 4 5 | 1 8 7 6 | 9 2]
Path crossovers • Cycle crossover (CX):p1 = [1 2 3 4 5 6 7 8 9] and p2 = [4 1 2 8 7 6 9 3 5] o1 = [1 x x 4 x xxxx] … 01 = [1 x x 4 x xx 8 x]… o1 = [1 2 3 4 x x x 8 x]
Adjacency crossovers • Alternating edges crossover: p1 = [2 3 8 7 9 1 4 5 6] and p2 = [7 5 1 6 9 2 8 4 3] o1 = [2 5 8 7 9 1 6 4 3] • Randomly choose an edge from the first parent, then select an appropriate edge from the secondparent, and so.
Adjacency crossovers • Subtour-chunks crossover • Similar to “Alternating Edges”, but instead of switching only one element, switch a random-length subtour from one of the parents.
Adjacency crossovers • Heuristic crossover • Choose a random city, then compares two edges that emanate from this city from both parents. • Choose the one with lower cost. • The city on the other end of this edge, is the next starting point.
Ordinal crossover • Ordinal representation: • Reference C: C = [1 2 3 4 5 6 7 8 9] • List l of references, l = [1 1 2 1 4 1 3 1 1] • In path encoding, equal to: [1 2 4 3 8 5 9 6 7]
Ordinal crossover • Cut-and-splice crossover • Take a part from one parent, and splice it with the remainder from the second parent.
Strategies used: Elitism • Maintain the best individual found so far in the population. • Applied only if the population is equal or greater than 4.
Strategies used: Getting out of Local Optima • Randomize one or two children when both are equal after reproduction. • This increased the performance of the GA in general, due to the high frequency of GA being stuck in a local optima. • Other option: randomize entire population if best solution does not change after Y iterations.
Strategies used: Multiple Crossovers • After a while, single crossover methods start lacking variety in their reproductions. • Possible solutions: • Randomize part of the population. and/or: • Change crossover method in real time, during execution.
Strategies used: Multiple Crossovers • During execution, switch crossover method when “best solution” doesn’t change during n iterations. • Conversion of all individuals is necessary if switch is between a Path and an Adjacency crossover. • Crossovers used: • Heuristic (Adjacency) • Partially Mapped (Path) • Order (Path) • Subtour-chunks (Adjacency)
Tests - Djibouti Optimal tour: 6656
Tests – W. Sahara Optimal tour: 27603
Tests – Xqf131 Optimal tour: 564 Heuristic Heur+PMX+OX+Subtour
Tests - Qatar Optimal tour: 9352 Num Iterations: 40000
Tests - Qatar Optimal tour: 9352 Num Iterations: 10000
Tests - Qatar Num. Iterations: 200000; Population = 4; Optimal tour: 9352 Multiple: 9910 Heuristic: 9830
Tests - Uruguay Num. Iterations: 400000; Population: 8 Multiple: 236667 Heuristic: 423593 734 citiesOptimal tour: 79114
Conclusion • Heuristic showed best performance between the 7 implemented. • Converges quickly to a “good” solution • But after an amount of iterations it gets “stuck” • Followed by the Order. • Ordinal with its Cut-and-splice is easy to implement and works well in some GA problems, but not in TSP.
Conclusion • Multiple crossovers shows its advantages in long term executions. • Heuristics seems to be the best choice for low number of iterations and small number of cities. • Multiple technique showed to be a safer bet in long executions and bigger inputs, due to its continuous discovery of new solutions.
Conclusion • What might improve the Multiple technique: • Store information about crossovers performance during execution and then select the current best techniques more frequently. • Vary number of iterations necessary to switch crossover, based on their current performance.