Utrecht University INFOB2KI 2019-2020 The Netherlands ARTIFICIAL INTELLIGENCE Evolutionary computing Lecturer: Silja Renooij These slides are part of the INFOB2KI Course Notes available from www.cs.uu.nl/docs/vakken/b2ki/schema.html
What is it? Evolutionary computing (EC) = the use of evolutionary algorithms (EAs): Population‐based, stochastic search algorithms based on mechanisms of natural evolution. – Evolution viewed as search algorithm or problem solver – Natural evolution only used as metaphor for computational system design
Why the metaphor? Ability to efficiently guide a search through a large solution space Ability to adapt solutions to changing environments Goal: design high quality solutions through “emergent” behavior
Darwinian process characteristics 5 key requirements of a Darwinian system: 1. Structures carry information (e.g. DNA) 2. Structures are copied (next generation) 3. Copies partially vary from the original (inheritance) 4. Structures compete for limited resources (Struggle for life selection) 5. Relative reproductive success depends on environment (Survival of the fittest) There is no evolution without competition.
Darwinian characteristics in EC 1. Structures e.g. binary strings, real‐valued vectors, programs,… 2. Structures are copied Selection algorithm: e.g. tournament selection, … 3. Copies partially vary from the original Mutation & crossover operators 4. Structures compete for limited resources New offspring (partly) replaces parents in fixed size population 5. Relative reproductive success depends on environment User‐defined fitness function
EC streams EC unites four traditionally distinct streams, based on historical differences in representation : Genetic algorithms (GA) – Solutions encoded as discrete structures, e.g. bit‐strings Evolution strategies (ES) – Encoding using real‐valued vectors Evolutionary programming (EP) – Encoding with finite state machines Genetic programming (GP) – Encoding using trees Nowadays we just use what seems most appropriate.
EAs: Main idea Take a population of candidate solutions to a given problem Use operators inspired by the mechanisms of natural genetic variation Apply selective pressure toward certain properties (what does “fit” mean?) Evolve a more fit solution
General Scheme of EAs generation Based upon replacement strategy
Evolutionary terminology Inspired by biology: Individuals: candidate solutions Phenotypes: solutions in the real world Genotypes: individuals within the EA Population: – (representations of) possible solutions – usually fixed size multiset of genotypes – Diversity of a population refers to the number of different fitness’s / phenotypes / genotypes present (note not the same thing) Also: genes, chromosomes, …
Design of an Evolutionary Algorithm
The Steps - I In order to build an evolutionary algorithm we have to perform various steps. External to the evolving system: Design a representation for individuals: – A data‐structure – A mapping between phenotype and genotype (encoding and decoding) Decide how to initialize a population Decide when to stop the algorithm
The Steps - II In order to build an evolutionary algorithm we have to perform various steps. Internal to the evolving system: Design a way of evaluating an individual Decide how to select parent individuals Design suitable recombination operator(s) Design suitable mutation operator(s) Decide how to select surviving individuals Variation operators
The external design steps
Initialisation Usually done at random Uniformly on search space if possible – Binary strings: 0 or 1 with probability 0.5 – Real‐valued representations: uniformly on a given interval Or: seed the population with previous results or those from heuristics. With care: – Possible loss of genetic diversity – Possible unrecoverable bias
Stopping criterion Termination condition checked every generation Reaching some (known/hoped for) fitness optimum Limit on CPU resources: Reaching some maximum allowed number of generations Reaching some minimum level of diversity Limit on user’s patience: Reaching some specified number of generations without fitness improvement
Designing a Representation Method/ data structure for representing an individual as a genotype (encoding) – often takes the form of a bit string in GAs – usually different parts of structure represent different aspects of solution Choice depends on – the problem to solve – how genotypes will be evaluated – what genetic operators might be used/suitable
Discrete Representation an individual can be represented using discrete values – binary; integer; any other system with discrete set of values CHROMOSOME Example: binary representation GENE
Discrete Representation for each genotype there must be a phenotype Example: Phenotype: • Integer 8 bits Genotype • Real Number • Schedule • ... • Anything?
Example: genotype to phenotype Phenotype could be integer numbers Genotype: Phenotype: = 163 1*2 7 + 0*2 6 + 1*2 5 + 0*2 4 + 0*2 3 + 0*2 2 + 1*2 1 + 1*2 0 = 128 + 32 + 2 + 1 = 163 Phenotype could be real numbers Phenotype: (between 2.5 and 20.5) Genotype: = 14.00 163 x 2 . 5 20 . 5 2 . 5 14 . 00 255
Example: genotype to phenotype Phenotype could be a schedule Time Job Step 1 2 Genotype: 2 1 3 2 4 1 = Phenotype 5 1 6 1 7 2 8 2 Phenotype could be …
The internal design steps
Evaluating an Individual Often based upon fitness – A measure of the goodness of the organism – The more values the fitness function distinguishes the better for selection – Can also be based on results of some external process: e.g. competing models for a game This is by far the most costly step for real applications You could use approximate fitness ‐ but not for too long
Parent Selection Mechanism Selection pressure: ensure that selection of better individuals is more probable than of less good individuals drives population forward ! less good individuals may still include some useful genetic material Methods (a.o): – Proportionate selection typical textbook method; not often used in practice – Rank‐based selection • Truncation selection • Tournament selection
Fitness proportionate selection I Selection based on absolute fitness values Given a population of N individuals, individual i is � selected with probability � � � ��� Selecting again N parents expected number of times individual i is selected for mating is: f where is average fitness � �
Fitness proportionate selection II Best Better (fitter) individuals have: more space in population pool more chances to be selected Worst Disadvantages: Danger of premature convergence: (seemingly) outstanding individuals take over entire population very quickly Low selection pressure when fitness values are near each other local optima
Truncation selection Rank based selection: use relative rather than absolute fitness Individuals are sorted on their fitness value from best to worse. Select the top τ % Copy each selected solution 100/ τ times (for fixed population size)
Tournament selection For a tournament of size k : Select k random individuals for tournament (with or without replacement) Select only the best individual as parent Hold N tournaments to get a population of N
Variation operators with examples for discrete structures (GAs)
Recombination/Crossover We can have one or more recombination operator for a representation. Mimics biological recombination – Some portion of genetic material is swapped between chromosomes – Typically the swapping produces offspring Offspring inherits parts from each of m ≥ 2 parents Recombination should produce m valid chromosomes Stochastic: – n cross‐over point(s) selected randomly – Operator applied with a certain probability
1-point cross-over Whole Population: . . . Each chromosome is cut into 2 pieces (at same cutpoint) which are recombined: cut cut parents 1 1 1 1 1 1 1 0 0 0 0 0 0 0 offspring 1 1 1 0 0 0 0 0 0 0 1 1 1 1
n-point & uniform cross-over n‐point cross‐over: each chromosome is cut into n+1 pieces which are recombined Uniform cross‐over: for each position, swap with a certain probability
Mutation We can have one or more mutation operators for a representation. Mechanism for preserving variety in the population At least one mutation operator should allow every part of the search space to be reached Mutation should produce valid chromosome Stochastic: – Alters the structure in a position with some probability – Operator applied with a certain probability
Mutation parent before 1 1 1 1 1 1 1 after 1 1 1 0 1 1 1 offspring mutated gene Mutation usually happens with small probability p m for each ` gene’
Recommend
More recommend