Genetic Algorithms
Przemyslaw Pawluk
CSE 6111
Advanced Algorithm Design and Analysis
03

12

2007
03

12

2007
2
Agenda
•
The overview of the genetic idea
•
The structure of genetic algorithms
•
Where to use?
•
The genetic algorithm for Traveling
Salesman Problem
•
Summary
3
The overview
–
definitions
•
Genotype (genome)
–
population of abstract
representations of candidate solutions.
•
Phenotype
–
the candidate solution.
•
Fitness function
–
particular type of
objective function that quantifies the
optimality of the solution.
4
Generation, Selection, Modification
•
The genetic algorithm usually starts from
randomly generated population.
•
In each generation, the fitness of every individual
in the population is evaluated,
•
Multiple individuals are stochastically selected
from the current population (based on their
fitness), and modified (recombined and possibly
randomly mutated) to form a new population.
•
The new population is then used in the next
iteration of the algorithm.
5
Algorithm
Choose initial population
Evaluate the fitness of each individual in the population
Repeat until
gen_no
>
max_gen_no
or
best
<=
<loop

inv:
gen_no
<
max_gen_no
and we have a
set of
valid solution
s and a best solution
best
that is not
necessarily optimal>
Select best

ranking individuals to reproduce
Breed new generation through crossover and mutation
(genetic operations) and give birth to offspring
(
gen_no
++)
Evaluate the individual fitnesses of the offspring (set
best
)
Replace worst ranked part of population with offspring
6
Changes

Mutation, Crossover
•
Mutation
–
the random change in the
chromosome.
•
Crossover
–
two chromosomes change some
portion of information
i.e. Random change
of some bits in the
representation
7
Genotype representation
•
Usually binary arrays (lists) are used, to
make the crossover operations easy
however other representation are also used.
8
Termination
•
A solution is found that satisfies minimum criteria.
•
Fixed number of generations reached.
•
Allocated budget (computation time/money)
reached.
•
The highest ranking solution's fitness is reaching
or has reached a plateau such that successive
iterations no longer produce better results.
•
Manual inspection.
•
Combinations of the above.
9
Applications of GA
•
Designing neural networks, both
architecture and weights
•
Robot trajectory
•
Evolving LISP programs (genetic
programming)
•
Strategy planning
•
Finding shape of protein molecules
•
TSP and sequence scheduling
•
Functions for creating images
10
Traveling Salesman Problem
•
Input
–
the set of cities (nodes) and the
distances between them.
•
Output
–
the permutation of cities.
•
Goal
–
to find the minimal Hamiltonian tour.
d
x
i
x
i+
1
is a distance between
x
i
and
x
i+1
(
d
x
i
x
i+
1
+ d
x
n
x
1
)
min
n

1
i
=1
11
Traveling Salesman Problem
•
Permutation encoding used to encode
chromosomes.
•
Each chromosome is a string of numbers,
which represents number
of town
in a
entry
sequence.
Chromosome A
1
5
3
2
6
4
7
9
8
Chromosome
B
8
5
6
7
2
3
1
4
9
12
TSP
–
crossover and mutation
•
Mutation
–
take 2 arbitrary elements and
swap them
•
Crossover
Chromosome A
1
5
3
2
6
4
7
9
8
Chromosome
B
8
5
6
7
2
3
1
4
9
Offspring A
1
5
3
2
6
4
8 7 9
Offspring B
5
6
2
3
1
4
7
9
8
13
Traveling Salesman Problem
•
Traveling salesman problem is NP

hard.
•
The time to find the optimal solution is
exponential.
•
Application of the GA can reduce the time
to polynomial, but do not guarantee that the
optimal solution will be found.
•
Example:
Genetic Algorithm for TSP
.
14
Summary
•
Improvements by crossing over
•
Random mutation to avoid stucking in
local
min/max
•
Widely used
15
Questions
Comments 0
Log in to post a comment