1 / 15

ECE 103 Engineering Programming Chapter 52 Generic Algorithm

ECE 103 Engineering Programming Chapter 52 Generic Algorithm. Herbert G. Mayer, PSU CS Status 6/4/2014 Initial content copied verbatim from ECE 103 material developed by Professor Phillip Wong @ PSU ECE. Syllabus. Generic Algorithm C C C c. Genetic Algorithms

piper
Télécharger la présentation

ECE 103 Engineering Programming Chapter 52 Generic Algorithm

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. ECE 103 Engineering ProgrammingChapter 52Generic Algorithm Herbert G. Mayer, PSU CS Status 6/4/2014 Initial content copied verbatim from ECE 103 material developed by Professor Phillip Wong @ PSU ECE

  2. Syllabus • Generic Algorithm • C • C • C • c

  3. Genetic Algorithms A genetic algorithm (GA) can solve certain classes of optimization problems in which: The details of the problem are not well known. The search space is large. Genetic algorithms are based on the biological principles of evolution and selection. 3

  4. General Plan: An initial randomized population of candidate solutions is constructed. For each subsequent generation: The current generation is evaluated to determine its “fitness”. The most fit candidates are selected for “reproduction”. A new generation of offspring is created. This continues until a suitable solution is found or a fixed number of generations is reached. 4

  5. Solutions are encoded as “bit strings”, e.g., a sequence of 1’s and 0’s stored in an array. Fitness is determined by how well a candidate solution meets a pre-defined criterion. Roulette wheel selection:An individual’s probability of being selected is directly proportional to its fitness. Only selected individuals are allowed to reproduce. 5

  6. Typical reproduction methods: Crossover - potentially copies good (or bad) traits: Mutation (helps introduce genetic variety): 6

  7. Expressed in terms of arrays: Create initial population Pcurrent from N randomized bit strings (arrays) Create blank population Pnext to hold N bit strings (arrays) FOR up to G generations Evaluate population Pcurrent for fitness Initialize roulette wheel using fitness results Select parents from Pcurrent using roulette wheel probabilities Create population Pnext by generating N offspring using genetic operators Copy Pnext to Pcurrent END FOR 7

  8. Depending on N, L, and # of generations to run, the array copy operation can be expensive. Why not use pointers to arrays instead? Pcurrent N bit-strings of length L (NL array) Evaluate fitness Pnext N bit-strings of length L (NL array) Initialize roulette wheel Generate offspring Roulette wheel selects parents Copy the contents of array Pnext to array Pcurrentone element at a time. In other words, the next generation becomes the current generation. 8

  9. Expressed in terms of pointers: Create initial population PA from N randomized bit strings (arrays) Create blank population PB to hold N bit strings (arrays) Assign pointer Pcurrent→ PA and pointer Pnext→ PB FOR up to G generations Evaluate population Pcurrent for fitness Initialize roulette wheel using fitness results Select parents from Pcurrent using roulette wheel probabilities Create population Pnext by generating N offspring using genetic operators Swap pointers Pcurrent and Pnext END FOR 9

  10. Evaluate fitness Evaluate fitness Pcurrent PA N bit-strings of length L (NL array) Pcurrent PB N bit-strings of length L (NL array) Gen k PB N bit-strings of length L (NL array) PA N bit-strings of length L (NL array) Pnext Pnext Initialize roulette wheel Initialize roulette wheel Generate offspring Generate offspring Roulette wheel selects parents Roulette wheel selects parents Swap the pointers Pcurrent and Pnext. Swap the pointers Pcurrent and Pnext. Gen k+1 10

  11. Example: Find the minimum of the following equation: f (x, y) = 4x2 – 2.1x4 + (1/3)x6 + xy – 4y2 + 4y4 over the range –5 x, y 5 Using Mathcad, the global minimum value forf (x, y) on the defined interval is –1.0316285. This occurs at: (x0, y0) = (– 0.089842, +0.7126564) (x1, y1) = ( +0.089842, –0.7126564) 11

  12. Run a genetic algorithm simulation using these reproduction methods: (GA-1) M1 = 1-point crossover and M2 = complement randomly chosen bit position. Probabilities are p1 = 0.97 and p2 = 0.03. The GA is not elitist. (GA-2) Identical to GA-1 except that M1 = 2-point crossover. (GA-3) M1 = 1-point crossover with p1 = 1.0. No M2 is defined. Each bit in each member of the offspring population is complemented with a probability of 10-5. The GA is not elitist. (GA-4) Identical to GA-3 except that the GA is elitist. 12

  13. Simulation results: Comparison to Mathcad locations for minimum: (x0, y0) = (– 0.089842, +0.7126564) (x1, y1) = ( +0.089842, –0.7126564) 13

  14. 0 14

  15. Example: NASA experiment to design an X-band antenna (8 to 12 GHz range for satellite communications): Result: improved performance and efficiency 15

More Related