Solving the Travelling Salesman Problem Using a Genetic Algorithm - PowerPoint PPT Presentation

1 / 12
About This Presentation
Title:

Solving the Travelling Salesman Problem Using a Genetic Algorithm

Description:

Toni Jaakkola. The Travelling Salesman Problem. A salesman has to visit a certain number of cities, where every city is visited ... – PowerPoint PPT presentation

Number of Views:3686
Avg rating:3.0/5.0
Slides: 13
Provided by: www21
Category:

less

Transcript and Presenter's Notes

Title: Solving the Travelling Salesman Problem Using a Genetic Algorithm


1
Solving the Travelling Salesman Problem Using a
Genetic Algorithm
  • Lappeenranta University of Technology
  • Ti5261300 Evolutionary Algorithms
  • Project work
  • Toni Jaakkola

2
The Travelling Salesman Problem
  • A salesman has to visit a certain number of
    cities, where every city is visited once, and
    only once, and the whole trip is as short as
    possible. Which route should he choose?
  • An NP-compelete combinatorial problem

3
TSP as an optimization problem
  • Combinatorial optimization
  • The objective function is the sum of the
    euclidian lengths of all edges among the
    salesman's route
  • The search space is a discrete space of all
    permutationsof N cities
  • Causes challenges and limitations for the genetic
    algorithm!

4
The genetic algorithm in pseudo code
  • Create a random map of N cities
  • Create a random population of solutions
  • Repeat
  • Repeat
  • Select two parents using Tournament Selection
  • Generate two offspring using Partially Matched
    Crossover
  • Mutate Offspring 1 with a given probability
    using Swap Mutation
  • Mutate Offspring 2 with a given probability
    using Swap Mutation
  • Add the resulting offspring to the new generation
  • Until (population in new generation population
    in parent generation)
  • Replace the parent generation using Elitist
    Replacement
  • Until (no improvement to the best solution has
    occurred in G generations)

5
The structure of the population
  • Cities numbered by integers, coordinates stored
    in arrays xcity_number and ycity_number
  • Routes represented as sequences of city numbers.
    The population is implemented as a 2-dimensional
    arraygenomegenome_numberroute_index
    city_numberwhere genome_number is an integer
    used for identifying the genome, route_index is
    the location of the city city_number on the
    salesman's route.

6
Parent selection
  • The Tournament SelectionRepeat Pick k random
    individuals from the population From those k
    individuals, pick one with the best fitness If
    the same individual chosen as both parents,
    discard the second oneUntil (two parents
    chosen)
  • The parameter k is the tournament size

7
Crossover
  • Partially Matched Crossover (PMX)
  • Choose two random crossing sitesParent 1 2 5
    14 0 93 7 8 6Parent 2 5 9 27 6 83 4 0 1
  • Exchange the segment between the crossing
    sitesOffspring 1 2 5 17 6 83 7 8 6Offspring
    2 5 9 24 0 93 4 0 1
  • Exchange the duplicate allelesOffspring 1 2 5
    17 6 83 4 9 0Offspring 2 5 8 24 0 93 7 6 1

8
Mutation
  • Swap mutation
  • Two positions of the offspring are picked
    randomly, and their values swapped4 2 6 5 8 9 0
    1 37 ? 4 2 0 5 8 9 6 1 3 7
  • Mutation takes place in each offspring with a
    given probability

9
Replacement
  • The Elitist replacement
  • From the combined population of parents and
    offspring, a number e of elites is chosen. The
    elites are the e individuals with the best
    fitness. All the elites will be transferred into
    a new parent population, and the rest will be
    chosen randomly from the offspring.
  • The number of elites is given as a percentage of
    population size.

10
The test runs Convergence
11
The effect of the number of cities
12
The effect of the population size
Write a Comment
User Comments (0)
About PowerShow.com