Download presentation
Presentation is loading. Please wait.
1
introduction to Genetic Algorithms Yonatan Shichel
2
Genetic Algorithms Bio-Inspired Bio-Inspired artificial intelligence class of probabilistic optimization algorithms §Well-suited for nonlinear/hard problems with a large search space §Developed by John Holland §Influenced by Darwin’s Origin of species What are Genetic Algorithms?
3
Evolution Variety Variety of species individuals within the population Competition Competition for limited resources Overproduction Overproduction of offspring generation §Survival of the fittest Origin of Species, 1859 Darwin’s principles
4
Evolution §Initial population Variety of shapes, colors, behaviors Each individual fits differently to the environment How does it work?
5
Evolution §Initial population §Reproduction Offspring combines both parents properties Siblings may differ in properties Mutations may occur How does it work?
6
Evolution §Initial population §Reproduction §Limited environmental resources Only a portion of the individuals survive Survival chances – according to fitness measure...... usually. How does it work?
7
Evolution Observations §Changes in the population content “good” properties are kept, “bad” are distinct evolutionary pressure
8
Genetic Algorithms The computational model produce an initial population of individuals while (termination condition not met) do evaluate the fitness of all individuals select fitter individuals for reproduction recombine between individuals mutate individuals
9
Genetic Algorithms The computational model initial population produce an initial population of individuals termination condition while ( termination condition not met) do evaluate evaluate the fitness of all individuals select select fitter individuals for reproduction recombine recombine between individuals mutate mutate individuals
10
Genetic Algorithms The computational model GnGnGnGn 55 44 12 31 95 32 87 12 0 65 53 2 91 73 + G n+1 = crossover mutation fitness
11
GA in action The Knapsack problem (NP) §There are N items: Each item i has a weight w i Each item i has a value v i §The knapsack has a limited capacity of W units. §The problem description: Maximize While
12
GA in action The Knapsack problem (NP) §For example: §Knapsack capacity = 100 JIHGFEDCBA 1230183425545192614 21411750231470182420
13
GA in action Before we begin… genome encoding 1.Define the genome encoding fitness function 2.Define the fitness function
14
GA in action Genome Encoding Bit array: 0 = don’t take the item 1 = take the item (items taken: A, B, E) 0000010011 -----E--BA
15
GA in action Genome Encoding Bit array: 0 = don’t take the item 1 = take the item (items taken: A, B, C, D, E, F, G, I) 0101111111 -I-GFEDCBA
16
GA in action Fitness Function JIHGFEDCBA 1230183425545192614 21411750231470182420
17
GA in action Fitness Function JIHGFEDCBA 1230183425545192614 21411750231470182420
18
Genetic Algorithms Fitness Evaluation produce an initial population of individuals while (termination condition not met) do evaluate evaluate the fitness of all individuals select fitter individuals for reproduction recombine between individuals mutate individuals
19
Genetic Algorithms Fitness Evaluation For each individual, calculate the fitness value:
20
Genetic Algorithms Selection produce an initial population of individuals while (termination condition not met) do evaluate the fitness of all individuals select select fitter individuals for reproduction recombine between individuals mutate individuals
21
Genetic Algorithms Selection §Fitness-proportionate (roulette wheel) §Rank Selection (scaling) §Tournament Selection §…
22
Genetic Algorithms Crossover produce an initial population of individuals while (termination condition not met) do evaluate the fitness of all individuals select fitter individuals for reproduction recombine recombine between individuals mutate individuals
23
Genetic Algorithms Crossover Using a crossover probability P C per individual: §Single point crossover §Two/multi points crossover §Uniform / weighted crossover §…
24
Genetic Algorithms Mutation produce an initial population of individuals while (termination condition not met) do evaluate the fitness of all individuals select fitter individuals for reproduction recombine between individuals mutate mutate individuals
25
Genetic Algorithms Mutation Using a crossover probability P M per bit: §Bit flip mutation §Bit switch mutation §…
26
Genetic Algorithms Crossover & Mutation examples
27
Genetic Algorithms Initial Population initial population produce an initial population of individuals while (termination condition not met) do evaluate the fitness of all individuals select fitter individuals for reproduction recombine between individuals mutate individuals
28
Genetic Algorithms Initial Population Create a fixed size population using: §Random generated individuals §Individuals resulted from previous evolutionary runs
29
GA in action Initial Population Example of random population:
30
Genetic Algorithms Termination Condition produce an initial population of individuals termination condition while ( termination condition not met) do evaluate the fitness of all individuals select fitter individuals for reproduction recombine between individuals mutate individuals
31
Genetic Algorithms Termination Condition §When an optimal solution is found §When the results converge to constant value §After a predetermined number of generations
32
Genetic Algorithms Sample Evolutionary Run §Population size: 100 individuals §Crossover: Single pt., P C =0.9 §Mutation: Bit flip, P M =0.01 §Selection: tournament, groups of 2 §Termination condition: after 100 generations
33
Genetic Algorithms Sample Evolutionary Run
34
Genetic Algorithms Conclusions §GA is nondeterministic – two runs may end with different results §There’s no indication whether best individual is optimal §Fitness tends to converge during time
35
Genetic Algorithms GA variations §Coevolution Cooperative Competitive §Parallel GA §Hybrid GA
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.