CapSel GA Genetic Algorithms.

Size: px
Start display at page:

Download "CapSel GA Genetic Algorithms."

Transcription

1 CapSel GA - 01 Genetic Algorithms keppens@rijnh.nl Typical usage: optimization problems both minimization and maximization of complicated functions completely standard problem with non-standard solution method genetic: inspired by nature key ideas from evolution theory (Darwinistic) natural selection & survival of the fittest initiated by John Holland in early 1970 s popular in computational science, AI,... gradually invading (infecting?) all exact sciences

2 CapSel GA - 02 Genetic algorithms in astrophysics: Astrophysical Journal Supplement Series 101, p (1995) discusses basic GA and application to 3 model problems Includes the 6D minimization problem for Weber-Davis wind PIKAIA code available for use see website of Paul Charbonneau at

3 CapSel GA - 03 The GA initial inspiration: natural evolution biological evolution: operates on chromosome level changes in chromosomes which encode living beings process of natural selection: links chromosome and performance of living entity it encodes chromosomes encoding successful beings reproduce more often evolution takes place at reproduction children chromosomes can be very different from parents chromosome changes by mutation and recombination biological evolution has no memory whatever it knows about performance of individuals is contained in gene pool and the way a chromosome is decoded

4 CapSel GA - 04 GA incorporates these ideas in heuristic search technique mostly used for optimization evolve a population by reproduction at chromosome level find best solution in a manner inspired by nature... radically different from standard approach hill-climbing or steepest ascent/descent methods local approach may fail miserably when multiple extrema occur

5 CapSel GA - 05 model problem: find global maximum of function on unit square [0, 1] 2 f(x, y) = [16x(1 x)y(1 y) sin (nπx) sin (nπy)] 2 steepest ascent works well for n = 1, but for n = 9... hard to find global maximum with random initial position

6 CapSel GA - 06 the genetic algorithm approach: construct random initial population of chromosomes evaluate fitness of each member (decode the chromosomes) create a new population by breeding evaluate the fitness of each member in new population replace (partially or completely) the old with new population check whether fittest individual matches the requirement if not: repeat from step 3 evolution program, differs in breeding step from more deterministic approaches like Monte Carlo

7 CapSel GA - 07 to define: what is a chromosome how to evaluate fitness of a chromosome how to breed only link with optimization problem at hand fitness evaluation from previous example with f(x, y): fitness can be function value the higher the function value, the better the fitness

8 CapSel GA - 08 the chromosome concept: most GA applications use bit strings of fixed length chromosome = bit string of 44 bits chromosome fitness uses decoding partition into two 22 bit strings and convert to base 10 to find and two integer numbers ranging from 0 till multiply by to map on [0, 1] and evaluate its fitness simply f(x, y) and find: fitness =

9 CapSel GA - 09 step 1 for GA: create population of certain size randomly create e.g. 100 bit strings of prescribed length sets the initial gene pool step 2 for GA: evaluate all fitnesses note embarrassingly parallel aspect (Supercomputing!) step 3 for GA: reproduction select two chromosomes from the gene pool create two new chromosomes by mutation and crossover inspired by their biological counterparts

10 CapSel GA - 10 introduce selection pressure in parent selection step sum all fitnesses, result is f tot generate random number between [0, f tot ] return first member whose fitness added to all preceding member fitnesses is greater than this number preferentially pick parents with higher fitness breed children by mutation preset mutation rate: probability parameter for every bit in parent: generate random number in [0, 1] if random number is below preset mutation rate: flip the bit }{{} {}}{ randomly changes chromosomes at single bit level

11 CapSel GA - 11 breeding children by crossover preset crossover rate: probability parameter 0.6 generate random number in [0, 1] if below crossover rate: pick randomly position between 1 44 (chromosome length) exchange chromosome parts following that position Parent : and Childs : and exchange of parental genetic material

12 CapSel GA - 12 breeding process replaces two parents with two children two preset parameter values: mutation & crossover rate note complete lack of knowledge about problem at hand finite probability of parents = children strategy for full generational replacement continue selecting parents untill gene pool empty replace all individuals by their offspring standard practice to introduce elitism always copy fittest member into next generation otherwise can fail to produce offspring but may dominate gene pool as super-individual

13 CapSel GA - 13 running the GA repetitive process creating new generations stop when fittest individual matches target fitness exceeds a preset value within tolerance or stop after certain number of generational replacements totally erratic process, mimicking life subsequent runs can differ dramatically typical to make average over certain number of runs again embarrassingly parallel: independent runs for different/same initial gene pools

14 CapSel GA - 14 convergence behavior: several phases rather rapid convergence initially fittest individuals dominate gene pool rapidly slow convergence later: only mutation rate introduces variation modifications to this basic GA not use base 2 chromosomes, but base 10 DNA-based life has base four : A-T-C-G parameters are population size, crossover rate, mutation rate variations of this: 2-point crossover, time-varying mutation rate

15 1995ApJS C CapSel GA - 15 example from Charbonneau

16 CapSel GA - 16 example from Charbonneau: Weber-Davis wind modeling 1995ApJS C

17 CapSel GA - 17 why does GA work? not well-understood patterns in chromosomes somehow reflect good fitness value potential stagnation of generation overcome with hybrid scheme use GA to generate initial guess for more traditional approaches (like steepest ascent/descent) combine best of two worlds (biology and mathematics... )

18 CapSel GA - 18 potential applications range from finding roots for complex dispersion relations χ 2 fitting procedures: curve fitting through data periodicity signal determinations: fitting noisy time series of pulsating stars inversion problems: determining internal solar rotation profile GA incorporates none of correctness, consistency, certainty, orderliness, justifiability but amazingly, they work!

19 CapSel GA - 19 References P. Charbonneau, Astrophysical Journal Supplement Series 101, 1995, 309 L. Davis, Handbook of genetic algorithms, 1991, Van Nostrand Reinhold, New York