Beruflich Dokumente
Kultur Dokumente
Algorithms
Yohai Trabelsi
Outline
Each chromosome
contains a set of genes.
A gene is a block of DNA.
Each gene determines
some aspect of the
organism
(e.g., eye colour).
Reproduction involves:
1. Recombination of genes from parents.
2. Small amounts of mutation (errors) in
copying.
Su
se r v
le iv
c t or
io
n
Initialization
Recombination
Mutation
Some history
First work of computer simulation of evolutionNils Aall Barricelli(1954)
In the 1950s and 1960s several researchers
began independently studying evolutionary
systems.
The field has experienced impressive growth over
the past two decades.
Genetic Algorithms
The research on Genetic Algorithms focuses on
imitating the evolution cycle in Algorithms.
That method is applicable for many hard search
and optimization problems.
Initialization
Initialization is the process of making the first
generation.
During the algorithm our goal will be to improve
them by imitating the nature.
Termination.
In the nature we dont have (yet) a point that the
process stops.
In many cases an algorithm that runs forever is
useless.
We should try to find the correct time for
terminating the whole process.
o That time may be after the results are good and/or before the
running time is too long.
Su
se r v
le iv
c t or
io
n
Initialization
ter
na
mi
ion
Recombination
Mutation
GA-Some definitions
In any generation there is a group of
individuals that belongs to that generation.
We call that group population.
Fitness will be a function from individuals to real
numbers.
The product of the recombination process is an
offspring.
Genetic Programming
Genetic Programming is Genetic Algorithm
wherein the population contains programs rather
than bitstrings.
A simple example
Problem:
Find the binary number 11010010.
Initialization
We start with 5 random binary numbers with 8
digits each.
1. 01001010
2. 10011011
3. 01100001
4. 10100110
5. 01010011
fitness(01001010)=-3
fitness(10011011)=-3
fitness(01100001)=-5
fitness(10100110)=-4
fitness(01010011)=-2
Parent Selection
In each generation, some constant number of
parents, say, 4 are chosen. Higher is the fitness,
greater is the probability of choosing the
individual.
{-3,-3, -5,-4,-2}
Assume we select , .
fitness() > fitness() selected.
We get {}
Recombination
Two selected parents will be coupled with
probability 0.5.
() , (, ), ()
3 is selected as a random number from 18
Then we do a crossover:
From () we get ()
We repeat that for each selected couple.
Mutation
For
Some Results
Similar
American Checkers
Michel32Nl
Lose Checkers
The rules are the same as in the original game.
The goal is opposite to the goal in the original
game: Each player tries to lose all of his pieces.
Player wins if he doesnt have any pieces or if he
cant do any move.
The complexity
There
Previous work
There are few recent results on Lose checkers.
They concentrate either on search or on finding a
good evaluation function.
They can help to improve good players but they
cant produce good players.
Improvements on a random player dont worth
much.
The algorithm
The individuals will be trees.
Each tree will behave like evaluation function for
the board states (more details later).
A tree represents a chromosome.
Each tree contains nodes.
A node represents a gene.
There are three kinds of nodes:
o Basic Terminal Nodes.
o Basic Function Nodes.
o Domain-Specific Terminal Nodes.
Return type
Node name
Ephemeral
Random
Constant
Floating
point
ERC
Boolean false
value
Boolean
False
Boolean true
value
Boolean
True
Floating
point
One
Floating
point
Zero
Node name
Domain-specific nodes
EnemyKingCount
EnemyManCount
EnemyPieceCount
FriendlyKingCount
FriendlyManCount
FriendlyPieceCount
FriendlyKingCount EnemyKingCount
KingCount
FriendlyManCount EnemyManCount
ManCount
FriendlyPieceCount EnemyPieceCount
PieceCount
KingFactor
Mobility
IsEmptySquare(X,Y)
IsFriendlyPiece(X,Y)
IsKingPiece(X,Y)
IsManPiece(X,Y)
The algorithm
Make initial population
While the termination condition didnt reached:
o Select the best candidates for being parents.
o Make the new generation by crossover and mutation
o Evaluate the fitness of the new generation.
Selection
Fitness evaluation
We define GuideArr to be an array of guide
players.
Some of them are random players which are
useful for evaluating initial runs.
Others, alpha-beta players, are based on search
up to some level and random behavior since that
level.
CoPlayNum is the number of players which are
selected randomly from the current population for
playing with the individual
under evaluation.
Image by Jon Sullivan
Fitness evaluation
back
Crossover
Randomly
Else
o Perform two-way crossover with I1 and I2
End if.
Similar to gene
transfer in
bacteria,
image by Y tambe
Mutation
We randomly choose a node in the tree for
mutation.
We do probabilistic decision whether to use the
traditional tree building mutation method or the
Local mutation method.
The probability for each method is given as a
parameter to our algorithm.
Traditional mutation
Traditional tree building mutation:
o Done by replacing the selected node with a new subtree.
Local mutation
Each node that returns a floating-point value
has a floating-point variable attached with it
(initialized to 1).
The returned value of the node was the
normal value multiplied by the variable.
The mutation is a small
change in the variable.
Termination
The Players
Some Results