1 / 38

Genetic Algorithms

Genetic Algorithms. Prepared by Eng. Mohamed Alsheakhali. Genetic Algorithms. Genetic Algorithms Definition Search space Genetic Algorithm Genetic Algorithms Operators Examples Conclusion. GA Definition.

carloshobbs
Download Presentation

Genetic Algorithms

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Genetic Algorithms Prepared by Eng. Mohamed Alsheakhali

  2. Genetic Algorithms • Genetic Algorithms Definition • Search space • Genetic Algorithm • Genetic Algorithms Operators • Examples • Conclusion

  3. GA Definition • Genetic algorithms are a part of evolutionary computing, which is a rapidly growing area of artificial intelligence. • Genetic algorithms is an algorithm that follows steps inspired by the biological processes of evolution.

  4. GA Definition

  5. GA Definition • Agenetic algorithms (GA) is asearchtechnique used to find exact orapproximatesolutions tosearchproblems. • Used for optimization.

  6. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Search space

  7. Search space • Local Search Hill climbing, Simulated annealing, Beam Search

  8. Describe Problem Generate Initial Population Test: is initial solution good enough? Step 1 Yes Stop No Select parents to reproduce Step 2 Step 3 Apply crossover process and create a set of offspring Apply random mutation Step 4 Step 5 Genetic Algorithm

  9. Genetic Algorithms Operators • We need the following • Representation of an individual (encoding) • Selection Criteria • Fitness Function • Reproduction Method • Replacement Criteria

  10. Encoding • Binary encoding • Permutation Encoding • Value Encoding

  11. Selection • Fitness proportionate. • Rank selection – sorts individual by fitness and the probability that an individual will be selected is proportional to its rank in this sorted list.

  12. Crossover (Recombination) 1 0 1 0 1 1 1 Parent 1 1 1 0 0 0 1 1 Parent 2 1 0 1 0 0 1 1 Child 1 Child 2 1 1 0 0 1 1 0 Mutation

  13. Crossover • Single­point crossover: • Parent A: 1 0 0 1 0| 1 1 1 0 1 • Parent B: 0 1 0 1 1 |1 0 1 1 0 • Child AB: 1 0 0 1 0 1 0 1 1 0 • Child BA: 0 1 0 1 1 1 1 1 0 1 • Two­point crossover: • Parent A: 1 0 0 1 0 1 1 1 0 1 • Parent B: 0 1 0 1 1 1 0 1 1 0 • Child AB: 1 0 0 1 1 1 0 1 0 1 • Child BA: 0 1 0 1 0 1 1 1 1 0

  14. Crossover n-point crossover

  15. Crossover – Permutation Encoding Single point crossover - one crossover point is selected, till this point the permutation is copied from the first parent, then the second parent is scanned and if the number is not yet in the offspring it is added (1 2 3 4 5 6 7 8 9) + (4 5 3 6 8 9 7 2 1) = (1 2 3 4 5 6 8 9 7) Mutation Order changing - two numbers are selected and exchanged (1 23 4 5 6 8 9 7) => (1 8 3 4 5 6 2 9 7)

  16. Crossover – Value Encoding All crossovers from binary encoding can be used Mutation Adding a small number (for real value encoding) - to selected values is added (or subtracted) a small number (1.29 5.68 2.864.115.55) => (1.29 5.68 2.734.225.55)

  17. Replacement • Generational updates • Steady state updates

  18. Search Termination • Maximum generations • Elapsed time • No change in fitness

  19. Genetic Algorithms Examples

  20. The Knapsack Problem (KP) • The KP problem is an example of a combinatorial optimization problem, which seeks for a best solution from among many other solutions. It is concerned with a knapsack that has positive integer volume (or capacity) V. There are n distinct items that may potentially be placed in the knapsack.

  21. The Knapsack Problem (KP)

  22. The Knapsack Problem (KP) • Item: 1 2 3 4 5 6 7 • Benefit: 5 8 3 2 7 9 4 • Volume: 7 8 4 10 4 6 4 • Knapsack holds a maximum of 22 cubic inches • Fill it to get the maximum benefit • Solutions take the form of a string of 1’s and 0’s • Solutions: Also known as strings of genes called Chromosomes • 1. 0101010 • 2. 1101100

  23. The Knapsack Problem (KP)

  24. Traveling Salesperson Problem

  25. Traveling Salesperson Problem Initial Population for TSP (5,3,4,1,2) (2,4,1,3,5) (4,3,1,5,2) (2,3,4,1,5) (4,3,1,2,5) (3,4,5,2,1) (3,5,4,1,2) (4,5,3,1,2) (5,4,2,3,1) (4,1,3,2,5) (3,4,2,1,5) (3,2,5,1,4)

  26. Traveling Salesperson Problem Selection (5,3,4,1,2) (2,4,1,3,5) (4,3,1,5,2) (2,3,4,1,5) (4,3,1,2,5) (3,4,5,2,1) (3,5,4,1,2) (4,5,3,1,2) (5,4,2,3,1) (4,1,3,2,5) (3,4,2,1,5) (3,2,5,1,4)

  27. Traveling Salesperson Problem Crossover (5,3,4,1,2) (2,4,1,3,5) (4,3,1,5,2) (2,3,4,1,5) (4,3,1,2,5) (3,4,5,2,1) (3,5,4,1,2) (4,5,3,1,2) (5,4,2,3,1) (4,1,3,2,5) (3,4,2,1,5) (3,2,5,1,4) (3,4,5,1,2) (5,4,2,1,3)

  28. Traveling Salesperson Problem Mutation (5,3,4,1,2) (2,4,1,3,5) (4,3,1,5,2) (2,3,4,1,5) (4,3,1,2,5) (3,4,5,2,1) (3,5,4,1,2) (4,5,3,1,2) (5,4,2,3,1) (4,1,3,2,5) (3,4,2,1,5) (3,2,5,1,4) (3,4,5,1,2) (5,4,2,3,1)

  29. Traveling Salesperson Problem Replacement (5,3,4,1,2) (2,4,1,3,5) (4,3,1,5,2) (2,3,4,1,5) (4,3,1,2,5) (3,4,5,2,1) (3,5,4,1,2) (4,5,3,1,2) (5,4,2,3,1) (4,1,3,2,5) (3,4,2,1,5) (3,2,5,1,4) (3,4,5,1,2) (5,4,2,3,1)

  30. Traveling Salesperson Problem

  31. Traveling Salesperson Problem

  32. Traveling Salesperson Problem

  33. Traveling Salesperson Problem

  34. Traveling Salesperson Problem

  35. Timetables • A complete university timetable must reach several requirements involving students, subjects, lecturers, classes, laboratory’s equipments, etc.

  36. Genetic Algorithm Application Areas • Dynamic process control • Induction of rule optimization • Discovering new connectivity topologies • Simulating biological models of behavior and evolution • Complex design of engineering structures • Pattern recognition • Scheduling • Transportation • Layout and circuit design • Telecommunication • Graph-based problems

  37. Conclusion • Genetic Algorithm is a powerful search technique especially for NP problems. • It used for speed and optimization purposes.

More Related