Professional Documents
Culture Documents
ENGINEERING
WEEK9
2
Strategies for Local Search
3
Pros
• Simple and intuitive
• No sophisticated technique required
Cons
• No guarantee for global optima
• Inefficient (or impossible) if dimension of DVs is high
5
Global Search Algorithms
6
HS
History
⚫ Pioneered by John Holland in the 1970’s
⚫ Got popular in the late 1980’s
⚫ Based on ideas from Darwinian Evolution
⚫ Can be used to solve a variety of problems that
are not easy to solve using other techniques
⚫ Evolution based on “survival of the fittest”
Background of GA
10
Evolution
– Organisms (animals or plants) produce a number of
offspring which are almost, but not entirely, like themselves.
– Some of these offspring may survive to produce offspring
of their own
• The “better adapted” offspring are more likely to survive
• Over time, later generations become better and better adapted
– Genetic Algorithms use this same process to “evolve” better
solutions
– The good solution survive, while bad ones die
Ideas for GA
11
A dumb solution
A “blind generate and test” algorithm:
➢ Repeat
✓ Generate a random possible solution
✓ Test the solution and see how good it is
➢ Until solution is good enough Can we use this dumb idea?
Sometimes - yes:
✓ if there are only a few possible solutions
✓ and you have enough time
✓ then such a method could be used
For most problems - no:
✓ many possible solutions
✓ with no time to try them all
✓ so this method can not be used
Ideas for GA
12
✓ Decision variable
✓ Objective function (=fitness function)
✓ Population (=individuals)
✓ Generation
✓ Parents/Offspring
✓ Crossover
✓ Mutation
✓ Elitism
Pseudo-code of GA
14
BEGIN
INITIALIZE population with random candidate solutions;
EVALUATE each candidate;
REPEAT UNTIL ( TERMINATION CONDITION is satisfied )
DO
1. SELECT parents;
2. RECOMBINE pairs of parents;
3. MUTATE the resulting offspring;
4. EVALUATE new candidates;
5. SELECT individuals for the next generation;
END
GA flowchart
15
Initialize
population
generation = generation +1
Evaluate Fitness
Yes
Satisfy
Constraints
No
Selection
Crossover
Mutation
Elitism Evaluate Fitness
GA processes - Crossover
16
▪ Crossover combines two parents to form new children for the next generation
▪ Crossover combines genetic material from two parents, in order to produce
superior offspring.
▪ Types of crossover:
Scattered
Single-point
Two-points
Intermediate
Material from Hoshin Gupta’s class note
GA processes - Mutation
17
▪ The selection function chooses parents for the next generation based
on the fitness function values
▪ Main idea : better individuals get higher chance to survive
• Changes proportional to fitness value
• Implementation : Roulette wheel technique
➢ Assign to each individual a portion of the roulette wheel
➢ Spin the wheel ‘n’ times to select ‘n’ individuals
Back to (Ideas for) GA
20
After 20 generations
After 50 generations
“optimtool”
Next week
24
▪ More details of GA
▪ GA exercise using MATLAB