1 / 33

FEUP | PDEEC | Decision Support

Populational Metaheuristics Genetic Algorithm. Group 1: Clara Gouveia Daniel Oliveira [Presenter ] Fabrício Sperandio Filipe Sousa. FEUP | PDEEC | Decision Support. January 17 th , 2011. Populational Metaheuristics: Genetic Algorithm. Outline.

penha
Download Presentation

FEUP | PDEEC | Decision Support

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. PopulationalMetaheuristics Genetic Algorithm Group 1: Clara Gouveia Daniel Oliveira [Presenter] FabrícioSperandio Filipe Sousa FEUP | PDEEC | Decision Support January 17th, 2011

  2. Populational Metaheuristics: Genetic Algorithm Outline Part One: Introduction to Genetic Algorithm • Metaheuristics Classification • Basic Concepts • Genetic Algorithm Flow • Genetic Algorithm Selection • Genetic Algorithm Operators • Crossover Example • Mutation Example Part Two: Paper Presentation FEUP | PDEEC | Decision Support • Motivation • Self-Adaptive Genetic Algorithm Flow • Heuristic • Crossover • Mutation • Evaluation • Experimental Results • Conclusion

  3. Populational Metaheuristics: Genetic Algorithm Metaheuristics Classification Populational Evolutionary Computation Particle Swarm Optimization Genetic Algorithms Evolution Strategies Ant Colony Optimization Nature Inspired Simulated Annealing FEUP | PDEEC | Decision Support Non Populational Tabu Search Variable Neighborhood Search GRASP

  4. Populational Metaheuristics: Genetic Algorithm Nature Inspiration FEUP | PDEEC | Decision Support Natural Selection: “a natural process that results in the survival and reproductive success of individuals or groups best adjusted to their environment and that leads to the perpetuation of genetic qualities best suited to that particular environment.” [1] References: [1]-Meriam–Webster Online Enciclopédia. Availabeat: http://www.merriam-webster.com/dictionary/natural+selection [2]-Source: http://www.genetic-programming.com/coursemainpage.html

  5. Populational Metaheuristics: Genetic Algorithm Basic Concepts Nature vs Optimization FEUP | PDEEC | Decision Support Phenotype Genotype

  6. Populational Metaheuristics: Genetic Algorithm Basic Concepts Genotype – Phenotype Mapping • Chromosome: • Coded version of the state variables. • May represent infeasible solutions of the problem. • Gene: elementary elements of the chromosome – movable parts. • Alleles: values that the genes can take – differentiates genes. Population Gene Alleles 1 0 1 1 0 1 0 N=1 FEUP | PDEEC | Decision Support N=2 1 0 1 1 0 1 0 … … … N 1 0 1 1 0 1 0 References: [1]-Handbookof Metaheuristics [2]-Source: http://lams.slcusd.org/pages/teachers/saxby/wordpress/?attachment_id=521

  7. Populational Metaheuristics: Genetic Algorithm Genetic Algorithm Flow Initializes Population • Coding and Initialization: • Encodingvariables and generating chromosomes. • Fitness Assignment: • Assess the fitness of the population according to a fitness function. • Selection: • Selects the chromosomes more fitted to breed. • Crossover: • Combinesinformation from two parents. • Mutation: • Introduces individual characteristics in the chromosomes. • Survival Selection: • Assess the fitness of the offspring and selects N elements to be included in the solutions Population. • Output: • GA needs a stopping criteria. (computational time, number of evaluations…) Fitness Assignment Selection Crossover Reproduction FEUP | PDEEC | Decision Support Mutation Survival Selection Output

  8. Populational Metaheuristics: Genetic Algorithm Genetic Algorithm Flow Initializes Population Coding and Initialization • Coding and Initialization: • Coding: • Choose the most adequate data type to obtain meaningful solutions . • Data types examples: • Bit strings (0011; 1101;….;0001) • Real numbers (12.5; 45.2;…;-33) • Discrete Elements (D1; D12;…;D23) • Initialization: • Generation of chromosomes: • Can represent a feasible solution (not mandatory) • Helps in the convergence of the algorithm • Fitness Assignment: • The fitness-function is problem dependent. Fitness Assignment Selection Crossover FEUP | PDEEC | Decision Support Mutation Survival Selection Output

  9. Populational Metaheuristics: Genetic Algorithm Genetic Algorithm Flow Initializes Population Parent Selection Fitness Assignment • Parents are chosen randomly amongst the most fitted. • Examples of selection methods: • Fitness-proportional selection. • Tournament selection. • Expected number of offspring generated by a parent i: Selection Crossover FEUP | PDEEC | Decision Support E( ni) =  • f(i)/ f Mutation Survival Selection Average fitness of the population Population size Fitness Valueof i Output

  10. Populational Metaheuristics: Genetic Algorithm Genetic Algorithm Flow Initializes Population Crossover and Mutation Fitness Assignment • In the reproduction phase we have two operators. • Crossover(intensification agent): • Explores an area somewhere “in between” two parent areas in the solution space. • It combines information from two parents. • Tries to maintain the good characteristics of both parents. • Mutation(diversification agent ): • Introduces new or lost alleles. • Avoids falling into a local optimum. Selection Crossover FEUP | PDEEC | Decision Support Mutation Survival Selection Output

  11. Populational Metaheuristics: Genetic Algorithm Genetic Algorithm Operators Control Parameters The user must specify also control parameters: • Population size: • May limit the genetic diversity, if it is too small. • Trade-offbetween efficiency and effectiveness. • Crossover/mutation probability: • How often the population crossover/mutation will be performed. • Both operators can have a probabilitysmaller than one. Choosing implementations methods: • Selectionand deletion methods. • Crossover/mutations operators. • Termination criteria: • Number of evaluations, running time, fitness function value FEUP | PDEEC | Decision Support

  12. Populational Metaheuristics: Genetic Algorithm Genetic Algorithm Selection Tournament Selection Procedure: • Pick tmembers randomly and select the best. • Repeat to select more individuals. Selection pressure: • Increases with the size of the tournament. • Increases if the chromosomes are selected with replacement. Pros: • Doesn’t need all the population available: • Allows distributed computing. Cons: • Good solution might never enter in the tournament. FEUP | PDEEC | Decision Support

  13. Populational Metaheuristics: Genetic Algorithm Genetic Algorithm Operators Crossover: One-Point Crossover In nature: P1 P1 P1 P1 One-point crossover: • Given the parents P1 and P2, with crossover in position 3 the offspring will be the pair O1 and O2: P1: 1 0 1 0 0 1 0 O1: 1 0 1 1 0 0 1 P2: 0 1 11 0 0 1 O2: 0 1 1 0 0 1 0 Crossover: Two parents produce two offspring. P2 P2 P2 P2 FEUP | PDEEC | Decision Support

  14. Populational Metaheuristics: Genetic Algorithm Genetic Algorithm Operators Crossover: Partially Mapped Crossover (PMX) P1 P1 P2 P2 O2 O2 FEUP | PDEEC | Decision Support P1 P1 P2 P2 O2 O2

  15. Populational Metaheuristics: Genetic Algorithm Genetic Algorithm Operators Mutation: Swap Mutation Mutation: Adds new information to the chromosome. A gene (or subset of genes) is chosen randomly and the ‘allele’ value of the chosen genes is changed: • By a swap with other gene. • Or by a new value, not present in parent. Mutation with the genes 3 and 5: FEUP | PDEEC | Decision Support P1: 1 0 1 1 0 0 1 O1: 1 0 0 1 1 0 1 mutation

  16. Populational Metaheuristics: Genetic Algorithm Outline Part One: Introduction to Genetic Algorithm • Metaheuristics Classification • Basic Concepts • Genetic Algorithm Flow • Genetic Algorithm Selection • Genetic Algorithm Operators • Crossover Example • Mutation Example Part Two: Paper Presentation FEUP | PDEEC | Decision Support • Motivation • Self-Adaptive Genetic Algorithm Flow • Heuristic • Crossover • Mutation • Evaluation • Experimental Results • Conclusion

  17. Populational Metaheuristics: Genetic Algorithm Part Two: Paper Presentation Applying Self-Adaptive Evolutionary Algorithms to Two-Dimensional Packing Problems using a Four Corners’ Heuristic Kevin J. Binkley, and Masafumi Hagiwara European Journal of Operational Research Volume 183, Pages 1230-1248, 16 June 2006. FEUP | PDEEC | Decision Support

  18. Populational Metaheuristics: Genetic Algorithm Motivation Study 2D-packing problems: • Objective: Use only one bin and minimize its trim loss. • Rotations are permited. • Compare Evolutionary Algorithms (EA): • Self-Adaptive Genetic Algorithm. • Self-Adaptive Parallel Recombinative Simulated Annealing (PRSA). • Use a Four Corners’ (FC) heuristic. FEUP | PDEEC | Decision Support Example (Phenotype) of a Bottom-Left (BL) packing approach. Numbers are the rectangles (genes) indexes (alleles). Empty space represents the trim loss.

  19. Populational Metaheuristics: Genetic Algorithm Self-Adaptive Genetic Algorithm Flow Initializes Population • Heuristic: • Four Corners’. • Evaluation: • Fitness function. • Pre-Selection: • Tournament selection with replacement. • Crossover – 4 types: • PMX. • Cycle Crossover. • Partially Mapped Crossover Random Locations (PMXR). • Preserve Location Crossover (PLX). • Mutation – 3 types: • Swap Mutation. • Rotation Mutation • Swap Corners’ Mutation. • Post-Selection (with evaluation): • Non-elitist. All childern survive to the next generation. Evaluates Population Pre-Selection Crossover FEUP | PDEEC | Decision Support While Stop Criteria Not Satisfied Mutation Post-Selection (Next Generation) Output

  20. Populational Metaheuristics: Genetic Algorithm Heuristic Four Corners’ Heuristic Genome A B A1 A2 B1 B2 Genome after FC heuristic division FEUP | PDEEC | Decision Support Phenotype of the genome following FC heuristic packing indications Trim space concentrates more in the center.

  21. Populational Metaheuristics: Genetic Algorithm Crossover PMX | Cyclic Crossover | PMRX | PLX Operators if (parent0.crossover_type = parent1.crossover_type) do parent0.crossover_type else if (rand(0,1) < 0.5) do parent0.crossover_type else do parent1.crossover_type endif • Each genome has a integer tag → [0, 3]. • The tag mutates during mutation phase: • According to a crossover mutation rate. • Crossover operator evolves with the population. PMRX random FEUP | PDEEC | Decision Support PLX Step 1 Step 2 Step 3

  22. Populational Metaheuristics: Genetic Algorithm Crossover Operators • Each of the children inherits the tag integer equivalent to the crossover operator used for their creation. • PMRXdistinguishes from PMX because it creates mappingsthroughout the genome. • PLXintroduces a degree of randomness, but like the other crossover operators, the common parents are preserved in the same location. FEUP | PDEEC | Decision Support

  23. Populational Metaheuristics: Genetic Algorithm Mutation Swap Mutation | Rotation Mutation | Swap Corners’ Mutation Operators • Swap Mutation: • Swaps two alleles and each of the existing has a chance of being mutated. • Rotation Mutation: • Rotates a allele and each of the existing has a chance of being mutated. • Swap Corners’ Mutation: • Swap corners’ between: BL↔BR, BR↔TL, BL↔TR, TL↔TR. • Each mutation operator has its own mutation rate: • Like the crossover operator, the mutation operators evolve with the GA. FEUP | PDEEC | Decision Support for pos = 0 to num_alleles – 1 if (rand(0,1) < swap_mutation_rate) swap_pos = (rand_int(0,num_alleles-1) + pos + 1 % num_alleles swap(pos, swap_pos) endif endfor Swap Mutation pseudo-code.

  24. Populational Metaheuristics: Genetic Algorithm Mutation Operators • Swap Mutation: • As the EA converge to an optimum, this mutation introducesnew or lost gene building blocks. • Rotation Mutation: • This mutation is similar to the swap mutation, but expands its search space. • Swap Corners’ Mutation: • Comparing to the other two mutations, this introducesnew individuals that are more distant in the search space – new building blocks. • We can see that mutation is importantinlaterstages of the EA to avoidsub-optimalsolutions. FEUP | PDEEC | Decision Support

  25. Populational Metaheuristics: Genetic Algorithm Evaluation Fitness Function • Fitness function implemented values more empty central space: • Trim loss remains are the primary evaluating parameter: • In a large population several genomes will have the same trim loss. • Central trim loss is more valued as differentiator parameter: • Fourth moment statistic implementation. FEUP | PDEEC | Decision Support The left implementation is preferable because the empty space is more central. The FC heuristic pack the genes moving the empty space to the center. Favoring center empty space phenotypes is then better.

  26. Populational Metaheuristics: Genetic Algorithm Experimental Results Settings • Packing software developed in C++ / Windows XP. • 31 problems published in the literature were used. • 10 runs done for each problem and the average result is presented. • Fixed parameters (self-adaptive GA): • Population size = 400. • Tournament size = 4. • Number of fitness function evaluations = 1.000.000. • Caching of the fitness evaluations was done to speed up the computation. • When a perfect packing is reached the run is stopped. • Problems run with and without rotations allowed. FEUP | PDEEC | Decision Support

  27. Populational Metaheuristics: Genetic Algorithm Experimental Results • The average trim loss result is generally much less than 1% for both algorithms. • PRSA produced better results than GA. • GA did better on 2 out of 3 of the most difficult problems, both with and without rotations. FEUP | PDEEC | Decision Support

  28. Populational Metaheuristics: Genetic Algorithm Experimental Results • In problems up to 97 rectangles perfect packing's were achieved when rotations were allowed. • Without rotations, perfect packing's were found only on problems up to 30 rectangles. • Allowing for rotations increases the search space and clearly makes easy to achieve a perfect packing. FEUP | PDEEC | Decision Support

  29. Populational Metaheuristics: Genetic Algorithm Experimental results • The GA quickly reached a trim loss of 0,0040 after 250.000 evaluations, before stagnation. • PRSA does not converge quickly, but gradually moves to an improved final trims loss of 0,0014. • With PRSA increase computational resources is straightforward. • GA is more complex and needs much more tuning: population size, tournament size, detecting convergence and restarting the GA. • GA beats PRSA on larger problems or when the number of fitness functions evaluations is limited to 100.000. FEUP | PDEEC | Decision Support

  30. Populational Metaheuristics: Genetic Algorithm Experimental results Four Corners’ Packing • Big rectangles are packed first to the corners and sides. • The trim loss tends to accumulatesin the center. • The packing structure is intuitive. • Larger rectangles are placed first in the corners, the smaller ones are moved around to find a better solution. FEUP | PDEEC | Decision Support

  31. Populational Metaheuristics: Genetic Algorithm Experimental results • Limited to 100.000 fitness function evaluations GA performed much better than PRSA. • After a typical run with self-adapting parameters, mutation rates decreased from their initial values. • Fixed settings performed better on smaller problems and fully adaptive much better on larger ones • GA results are quite sensitive to fixed mutation rates, however finding the right parameters is time consuming. • Self adapting GA can perform well on a wider range of problems and there are fewer parameters to set. FEUP | PDEEC | Decision Support

  32. Populational Metaheuristics: Genetic Algorithm Conclusions • The results achievedare the best found in literature until 2004. • In larger problems, resulting trim losses of much less than 1% were achieved. • PRSA generally produces higher quality packing's when computational resources are available. • GA produces better results when computational resources are limited. • Self-adaptive GA outperform fixed parameter GAs on larger problems. FEUP | PDEEC | Decision Support

  33. PopulationalMetaheuristics Genetic Algorithm Thank you for your attention!!! FEUP | PDEEC | Decision Support Questions?

More Related