genetic algorithms: solving the traveling salesman problem thomas abtey suny oswego

24
Destination: Amazon Rainforest Brazil, South America Topic: Photosynthesis and Cell Respiration

Post on 21-Dec-2015

220 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Genetic Algorithms: Solving the Traveling Salesman Problem Thomas Abtey SUNY Oswego

Genetic Algorithms: Solving the Traveling Salesman Problem

Thomas AbteySUNY Oswego

Page 2: Genetic Algorithms: Solving the Traveling Salesman Problem Thomas Abtey SUNY Oswego

Genetic Algorithm

- Invented by John Holland, 1960's

- Analogies to Biological Evolution

- Fitness

- Selection

- Crossover (Reproduction)

- Mutation

- Uses in Optimization, Approximation

Page 3: Genetic Algorithms: Solving the Traveling Salesman Problem Thomas Abtey SUNY Oswego

Genetic Algorithm (cont.)

- Evolution is a process of selection and reproduction

- Inheritance from Parents to Children

- Simplified cycle:

- For a population, assign fitness values to each individual

- Create a new population by breeding (and mutating) the fittest individuals

Page 4: Genetic Algorithms: Solving the Traveling Salesman Problem Thomas Abtey SUNY Oswego

Traveling Salesman Problem

- “Given a set of cities and their distances, what is the shortest tour possible visiting each city only once?”

- For 9 cities, 9! = 362,880 possible solutions- Application in scheduling/order problems- Brute-force method time becomes enormous

Page 5: Genetic Algorithms: Solving the Traveling Salesman Problem Thomas Abtey SUNY Oswego

Genetic Approach to TSP

- Population is a list of individuals- Individual is a list of cities- City is a name (and a set of distances)

> Houston Hollywood Las-Vegas SLC Chicago NYC Oswego Miami Philadelphia

Page 6: Genetic Algorithms: Solving the Traveling Salesman Problem Thomas Abtey SUNY Oswego

Mutation

- A mutation alters city ordering in an Individual - Two cities are chosen randomly to be switched

(A B* C D E F G* H)(A G* C D E F B* H)

Page 7: Genetic Algorithms: Solving the Traveling Salesman Problem Thomas Abtey SUNY Oswego

Crossover- Based on Greedy Subtour Crossover (GSX) by Sengoku and Yoshihara:

- Choose two parents, i1 and i2 - Choose a city as a mid-point for new tour

- From midpoint, do until tour will be invalid: - Place i1's cities to front of new tour - Place i2's cities to back of new tour

- Remaining cities (if any) will be appended to back of new tour

Page 8: Genetic Algorithms: Solving the Traveling Salesman Problem Thomas Abtey SUNY Oswego

Crossover (cont.)Example:

Mom = (ABCDEFGHI) Dad = (DFEGAHBCI)

Mid-Point = G---------------------------

(G)(FG)

(FGA)(EFGA)

(EFGAH)(DEFGAH)

(DEFGAHB-)(-CDEFGAHB-)

=>(CDEFGAHBI)

Page 9: Genetic Algorithms: Solving the Traveling Salesman Problem Thomas Abtey SUNY Oswego

Results

Brute-Force Solution: - (Hollywood Las-Vegas SLC Houston Chicago

Philadelphia NYC Oswego Miami) - A length of 40* - Multiple tours of length 40

* Multiplying this value by 1,000 will give actual geographic distance in miles.

Page 10: Genetic Algorithms: Solving the Traveling Salesman Problem Thomas Abtey SUNY Oswego

Results (cont.)- GA Solution: - Quickly reduces average tour length in a pop - Comes close to actual solution- GA with 25 individuals over 55 generations:

Generation 1 average fitness .. 112.2Generation 2 average fitness .. 91.53846Generation 3 average fitness .. 83.34615Generation 4 average fitness .. 78.23077

… Generation 54 average fitness .. 52.115383 Generation 55 average fitness .. 58.615383

Page 11: Genetic Algorithms: Solving the Traveling Salesman Problem Thomas Abtey SUNY Oswego

References & Resources

Senguko, H., Yoshihara, I. “A Fast TSP Solver Using GA on JAVA”. 1993.

Mitchell, M. “Introduction to Genetic Algorithms”. 1997.

Holland, H. “Adaptation in Natural and Artificial System: an introductory analysis with applications to biology, control, and artificial intelligence”. 1975.

Common LISP. http://clisp.cons.org

Page 12: Genetic Algorithms: Solving the Traveling Salesman Problem Thomas Abtey SUNY Oswego

Questions?

o ------ o / \ o o \ / o ------ o