































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An introduction to genetic algorithms (gas), a problem-solving methodology inspired by the principles of evolutionary biology. The basics of gas, including natural selection, genome representation, fitness heuristic, and crossover. The document also includes examples of ga applications in pathfinding and game programming.
Typology: Essays (university)
1 / 39
This page cannot be seen from the preview
Don't miss anything!
































Steve Gargolinski
Steve Gargolinski
[email protected] [email protected]
Strong members of a population survive to
Strong members of a population survive to
reproduce, passing on their âstrongâ traits
reproduce, passing on their âstrongâ traits
Crossover
Crossover
Some from parent A, some from parent B
Some from parent A, some from parent B
Mutation
Mutation
A strange flipped gene that cannot be traced back
A strange flipped gene that cannot be traced back
to a parent
to a parent
Usually binary, so 0 or 1
Usually binary, so 0 or 1
Represents our population
Represents our population
Maps back to how well an organism can
Maps back to how well an organism can
survive in an environment.
survive in an environment.
0.0f = terrible
0.0f = terrible
1.0f = absolute solution
1.0f = absolute solution
Start with a random genome pool of n members.
Start with a random genome pool of n members.
Run strength heuristic on each random genome
Run strength heuristic on each random genome
in the pool.
in the pool.
Randomlyâ crossbreed strong members of the
Randomlyâ crossbreed strong members of the
population until you have n new genomes.
population until you have n new genomes.
Introduce some mutation.
Introduce some mutation.
Repeat until the strength heuristic returns a
Repeat until the strength heuristic returns a
value within our threshold.
value within our threshold.
Simplest way is random selection
Simplest way is random selection
A better way is to weigh selection based on
A better way is to weigh selection based on
relative strength
relative strength
Roulette Wheel Selection
Roulette Wheel Selection
Definitely better
Definitely better
2D grid
2D grid
Arbitrary number of boundaries
Arbitrary number of boundaries
1 start point
1 start point
1 finish point
1 finish point
Simulate binary string movement beginning at
Simulate binary string movement beginning at
start point.
start point.
Measure distance from finish (simple,
Measure distance from finish (simple,
Pythagorean)
Pythagorean)
Fitness score = 1 â (distance / max possible
Fitness score = 1 â (distance / max possible
distance)
distance)
start
Genome A: 01 10 01 10 01 00 01 00
01 = Right
10 = Down
01 = Right (Bump)
10 = Down
01 = Right
00 = Up (Bump)
01 = Right
00 = Up
Fitness = 1 - (2 /
finish
Genome A: 01 10 01 10 01 00 01 00
Genome B: 00 01 10 10 11 10 01 01
Genome C: 01 10 01 10 01 00 01 01
This is how we take two genomes and create a new one:
(assumes no mutation for now)
start
01 = Right
10 = Down
01 = Right (Bump)
10 = Down
01 = Right
00 = Up (Bump)
01 = Right
01 = Right
Fitness = 1 â (0 /
finish
Genome C: 01 10 01 10 01 00 01 01
0.01 is a reasonable starting value
0.01 is a reasonable starting value
0.7 or so
0.7 or so
Varies a lot based on specific problem
Varies a lot based on specific problem
Try maybe 150-
Try maybe 150-