Genetic Algorithms: Evolving Solutions to Problems.
-
Upload
matthew-sutton -
Category
Documents
-
view
213 -
download
0
Transcript of Genetic Algorithms: Evolving Solutions to Problems.
![Page 1: Genetic Algorithms: Evolving Solutions to Problems.](https://reader035.fdocuments.net/reader035/viewer/2022072006/56649d215503460f949f6275/html5/thumbnails/1.jpg)
Genetic Algorithms: Evolving Solutions to Problems
![Page 2: Genetic Algorithms: Evolving Solutions to Problems.](https://reader035.fdocuments.net/reader035/viewer/2022072006/56649d215503460f949f6275/html5/thumbnails/2.jpg)
What is a Genetic Algorithm?
• Pool of possible solutions
• Randomly creates initial algorithms
• Relies on “survival of fittest”
• Uses mutation and crossover
• Follows a cycle of generations
![Page 3: Genetic Algorithms: Evolving Solutions to Problems.](https://reader035.fdocuments.net/reader035/viewer/2022072006/56649d215503460f949f6275/html5/thumbnails/3.jpg)
What can GAs be used for?
• Any problem that solutions can be rated for levels of success
• Difficult optimization problems including NP-hard and NP-complete
• Problems with “building blocks”
• Problems with functions that are undefined or don’t exist
![Page 4: Genetic Algorithms: Evolving Solutions to Problems.](https://reader035.fdocuments.net/reader035/viewer/2022072006/56649d215503460f949f6275/html5/thumbnails/4.jpg)
What are its accomplishments?
• Recreating technology like A-D converter, antennas
• Traveling Salesman Problem
• Knapsack Problem
• Outperforms hill-climbing and simulated-annealing
![Page 5: Genetic Algorithms: Evolving Solutions to Problems.](https://reader035.fdocuments.net/reader035/viewer/2022072006/56649d215503460f949f6275/html5/thumbnails/5.jpg)
How is it different from other optimization algorithms?
Hill-Climbing
-Kangaroo hops to top of nearest mountain.
Simulated-Annealing
-Drunken kangaroo hops around randomly, sobers up, and hops uphill.
Genetic Algorithm
-Kangaroos are released and allowed to roam. Flood drowns kangaroos on low hills, survivors multiply.
![Page 6: Genetic Algorithms: Evolving Solutions to Problems.](https://reader035.fdocuments.net/reader035/viewer/2022072006/56649d215503460f949f6275/html5/thumbnails/6.jpg)
What process does it follow?
![Page 7: Genetic Algorithms: Evolving Solutions to Problems.](https://reader035.fdocuments.net/reader035/viewer/2022072006/56649d215503460f949f6275/html5/thumbnails/7.jpg)
How is a GA set up?
• Data for the problem is encoded in each member
• Method determined for making initial population
• Fitness function is determined• Method of selection is chosen• Genetic operators are chosen• Population size, mutation probability
![Page 8: Genetic Algorithms: Evolving Solutions to Problems.](https://reader035.fdocuments.net/reader035/viewer/2022072006/56649d215503460f949f6275/html5/thumbnails/8.jpg)
Million Monkeys Example1 million monkeys try to write the word:
“shakespeare”Data Encoding: string 11 characters long,
character set 26 characters(a-z)Create Initial population: 20 random strings of the
26 allowed charactersFitness Function: Difference of each letter from
correct letterGenetic Operators: Single Crossover, MutationSelection: Top 50%
![Page 9: Genetic Algorithms: Evolving Solutions to Problems.](https://reader035.fdocuments.net/reader035/viewer/2022072006/56649d215503460f949f6275/html5/thumbnails/9.jpg)
1st generationxgagqlqohxn 62uwifceuigqb 65ghhmvntcqqf 67tpcahvntllp 72mulhbkubxrf 76fihsoghlfoh 77qdnbnvedhov 79nmnxovhkaqv 81tanjxinrcqu 85ltlboligpsm 89rtufqrkeuoq 91rntdphpnxsk 94mfsqxcuucoj 98huvbcvwpmpr 104kcigyfpaxrx 104vgnqijaqxpw 106nyljlfhbyxr 108oxqblcqgylq 113oavxnemsvha 120gnqwkqusshy 121
2nd generationghhmceuigqb 56*nkifceuigqb 58*tpcahvnrcqu 61*wgagqlqohxn 61uwifceuigqb 65ghhmvntcqqf 67tpcahvntllp 72uwifcehlfoh 72*tanjxincqqf 73*fihsogtcqqf 75*mulhbkubxrf 76qdnbnvedxrf 76*fihsoghlfoh 77qdnbnvedhov 79nmnxovhkaqv 81xgnjxinrcqu 83*tanjxinrcqu 85ltlboligpsm 89mulbnvedhov 90*ltnxovhkaqv 90*
Crossover
ghhmvntcggf and
uwifceuiggb =
ghhmceuiggb
Mutationxgagglgohxnwgagglgohxn
![Page 10: Genetic Algorithms: Evolving Solutions to Problems.](https://reader035.fdocuments.net/reader035/viewer/2022072006/56649d215503460f949f6275/html5/thumbnails/10.jpg)
Fitness
• Should reflect potential
• May need to provide constraints
• Penalties- Subtract from fitness
• Repairs- Repairs code outside const.
• Decoder- Change way of making algorithm, any individual is valid
• May need to be scaled
![Page 11: Genetic Algorithms: Evolving Solutions to Problems.](https://reader035.fdocuments.net/reader035/viewer/2022072006/56649d215503460f949f6275/html5/thumbnails/11.jpg)
Selection
• Roulette- random by fitness, many spins
• Stochastic Universal Sampling- many pointers, One spin
• Ranking- proportional by fitness• Tournament- random algorithms compete• Aging- given time to live, no selection• Crowding- new algorithms replace similar old• Multiple copies of same algorithm• Elitism- Best algorithms in next gen.
![Page 12: Genetic Algorithms: Evolving Solutions to Problems.](https://reader035.fdocuments.net/reader035/viewer/2022072006/56649d215503460f949f6275/html5/thumbnails/12.jpg)
Crossover and Mutation
• Crossover can kill ideal solutions (1*****10)
• Single crossover is the worst• Multi-point crossover• Uniform crossover• Genetic Diversity vs. Selective Pressure• Incest Prevention/ Speciation• Mutation better for diversity• May not allow “supers” to breed
![Page 13: Genetic Algorithms: Evolving Solutions to Problems.](https://reader035.fdocuments.net/reader035/viewer/2022072006/56649d215503460f949f6275/html5/thumbnails/13.jpg)
Messy Genetic Algorithms
• Provide data in an unorganized fashion
(position, value) ((5,0) (9,1) (4,1) (2,0))
• Crossover less damaging
• More genetic diversity
• Over-specification: May give too many values ((3,1) (4, 0) (3,0) (2,1) (1,1))
• Under-specification: May not give enough values ((4,0) (2,1))
![Page 14: Genetic Algorithms: Evolving Solutions to Problems.](https://reader035.fdocuments.net/reader035/viewer/2022072006/56649d215503460f949f6275/html5/thumbnails/14.jpg)
Plants and Eaters Example• 16 possible states• Able to “See” square directly in front of it• 4 possible actions( turn left, turn right,
move forward, move backward)• Acts on current state and what it can “See”• When it takes an action it sets a new state
http://math.hws.edu/xJava/GA/
![Page 15: Genetic Algorithms: Evolving Solutions to Problems.](https://reader035.fdocuments.net/reader035/viewer/2022072006/56649d215503460f949f6275/html5/thumbnails/15.jpg)
Questions?