Ec 04 2023
Ec 04 2023
Evolutionary Computation
EE-6950, Fall 2023
Lecture # 4 - EC Components
Outline
I. Homework Solution Review
II. EC Components
III. Homework #3
2
I. Homework:
Solution Review
Homework Solution Review
• HW #02
4
II. EC Components
Recap: Natural Evolution metaphor
• A population of individuals exists in an environment with limited resources
• Competition for those resources causes selection of those tter individuals that are better
adapted to the environment
• These individuals act as seeds for the generation of new individuals through recombination
and mutation
• The new individuals have their tness evaluated and compete (possibly also with parents)
for survival.
• Over time Natural selection causes a rise in the tness of the population
6
fi
Connection with Evolutionary Algorithms
• Stochastic Population of individuals
/Crossover
8
Basic EA Pseudo-Code
9
Two pillars of evolution
10
Evolutionary Algorithm Components
• Main EA components:
• Representation (Individual)
• Evaluation
• Population
• Selection: Parent selection/Survivor
• Variation: Recombination/Mutation
• Initialization/Termination
• Examples:
• Eight-queens problem
• EV1, the simplest EA ever!
11
Main EA components: Representation
12
EA components: Representation
Example: Represent integer values by their binary code
18
10
2
9 1001
Decoding
(inverse representation)
• Typically assigns a real-valued tness to each individual used as basis for selection
• So the more discrimination (di erent values) the better
• Population is the basic unit of evolution, i.e., the population is evolving, not the
individuals
• Some EAs also impose a spatial structure on the population e.g., a grid
16
EA components: Selection mechanism
Role:
• Identi es individuals…
- To become parents
- To survive
• Usually probabilistic
• High quality solutions more likely to be selected than low quality
• But not guaranteed
• Even worst in current population usually has non-zero probability of being selected
17
fi
fi
EA components: Selection mechanism
fitness(A) = 3 B
A C
fitness(B) = 1
3/6 = 50% 2/6 = 33%
fitness(C) = 2
18
EA components: Selection mechanism
19
ff
fi
ff
ff
EA components: Variation operators
• There has been much debate about relative importance of recombination and
mutation
• Nowadays most EAs use both
• Variation operators must match the given representation
20
EA components: Mutation
• Role: Causes random variance, potentially outside current “DNA” pool
• Acts on a single state (Individual) and delivers another (e.g., it’s a point operator)
ff
EA components: Mutation
before 1 1 1 1 1 1 1
after 1 1 1 0 1 1 1
22
EA components: Recombination
• Role: Merges information from parents into o spring
• Hope is that some are better by combining elements of genotypes that lead
to good traits
• Principle has been used for millennia by breeders of plants and livestock
23
ff
EA components: Recombination
Parents
cut cut
1 1 1 1 1 1 1 0 0 0 0 0 0 0
1 1 1 0 0 0 0 0 0 0 1 1 1 1
Offspring
24
EA components: Initialization/Termination
25
fi
fi
Example: The 8-queens problem
External representation:
a board configuration
Internal state:
Possible mapping
a permutation of
the numbers 1–8 1 3 5 2 6 4 7 8
27
The 8-queens problem: Fitness evaluation
28
fi
fi
The 8-queens problem: Mutation
1 3 5 2 6 4 7 8 1 3 7 2 6 4 5 8
29
The 8-queens problem: Recombination
1 3 526 4 7 8 1 3 542 8 7 6
8 7 654 3 2 1 8 7 624 1 3 5
30
The 8-queens problem: Selection
• Parent selection:
• Pick 5 parents and take best two to undergo crossover
31
fi
fi
fi
The 8-queens problem: Summary
33
Simple 1-D Optimization: Representation
- Note: Genotype and phenotype are equivalent in this case (i.e. there is no encoding/decoding
from internal state to natural external problem representation)
34
𝑥𝑥
Simple 1-D Optimization: Fitness Evaluation
35
Simple 1-D Optimization: Mutation
36
Simple 1-D Optimization: Recombination
• Crossover/recombination:
Take the average value of between the two parents
x′ = (x1 + x2)/2
Parent 1 Parent 2
Child
x1 x′ x2
37

𝑥

Simple 1-D Optimization: Selection
• Parent Selection:
• Randomly choose two parents from population using uniform distribution
38
fi
Simple 1-D Optimization: Summary
39
ff
Putting it all together: EV1
40
EV1: The simplest EA ever!
def ev1():
# start random number generator
prng=Random()
prng.seed(randomSeed)
42
EA’s in Action
• Runtime stages/behavior
43
fi
Representation & Different types of EAs
• Historically di erent avors of EAs have been associated with particular data
types to represent solutions
• Binary strings : Genetic Algorithms (GA’s)
• Real-valued vectors : Evolution Strategies
• Finite state Machines: Evolutionary Programming
• LISP trees: Genetic Programming
44
ff
ff
fl
fi
EA behavior: Runtime stages, Convergence
Typical stages in optimizing a 1-D tness landscape
Early stage:
quasi-random population distribution
Mid-stage:
population arranged around/on hills
Late stage:
population concentrated on high hills
45
fi
EA behavior: Runtime stages, Convergence
46
EA behavior: Typical progression of fitness
47
EA behavior: Evolutionary Algorithms in context
• There are many views on the use of EAs as robust problem solving tools
48
fi
EA behavior: EAs as problem solvers: The view circa 1989
Performance of methods on problems
Evolutionary algorithm
Random search
49
EA behavior: EAs and domain knowledge
• Trend in the 90’s:
- adding problem speci c knowledge to EAs
(special variation operators, repair, etc.)
• Recent theory suggests the search for a “universal” algorithm may be fruitless
50
ff
fi
EA behavior: EAs as problem solvers: The view circa 1996
Performance of methods on problems
EA 4
EA 2
EA 3
EA 1
51
Homework #3
- Due by Oct 5 @ noon
- Submit to iLearning
Homework #3
53
ff
ff
ff
fi
Homework #3
- Run some test parameters to see what happens, can you nd the global maximum?
(suggested parameters: population=10, generations=50, random-seed=1234
mutation-prob=25%, mutation-stddev=1.0, min/max-x=-100/+100)
- For output data, please use the same format as my existing printStats function in ev1.py, otherwise
you will drive the TA crazy! ☺
2. Using matplotlib, add capability to ev1 to plot a few interesting runtime metrics
(doesn't need to be interactive or real-time, unless you prefer):
- Best tness and state value vs. generation count
- Average and standard deviation of population tness vs. generation count
- The tness function, f(x)
54
fi
fi
fi
fi
fi
Homework #3: Recommended reading
• Recommended reading:
- Eiben Chapter 3
55
Next lecture…
EC Representation