"Owing to this struggle for life, any variation, however slight and from whatever cause proceeding, if it be in any degree profitable to an individual of any species, in its infinitely complex relations to other organic beings and to external nature, will tend to the preservation of that individual, and will generally be inherited by its offspring "It was Herbert Spencer who coined the term "survival of the fittest"
- Charles Darwin
In meiosis I chromosomes duplicate exchanging genetic information
[photo Simplified Biology]
Mutations can occur during meiosis or during gene expression
[photo By Rdbickel]
CENTRAL DOGMA
Genetic Algorithms solve optimization and search problems by representing a solution space as a chromosome and using simulated evolution to find the 'fittest' individual a.k.a. the solution to the problem.
Input: PopSize, Pcross, Pmutate, SelectAlg
Output: BestScore
Population = InitializePopulation(PopSize)
EvaluatePopulation(Population)
BestScore = Generations = 0
While (!StopCondition(BestScore,Generations,...))
Parents = SelectParents(Population, SelectAlg)
Children = none
For (parent1,parent2 in Parents)
child1,child2 = Crossover(parent1, parent2, Pcross)
Children += Mutate(child1, Pmutate)
Children += Mutate(child2, Pmutate)
End
EvaluatePopulation(Children)
BestScore = GetBestSolution(Children)
Population = Replace(Population, Children)
Generations += 1
End
Return (BestScore)
[from Clever Algorithms]
[image Tutorials Point]
Single-point crossover or multi-point by Pcross
Mutation randomly changes genes by Pmutate
[image By R0oland]
Fill a Halloweeen shopping bag w/ scary items
[image Wikimedia]
Item | Scariness | Cost | Scare/$ |
---|---|---|---|
Ghost | 11.00 | $5.00 | 2.2 |
Bat | 13.00 | $7.00 | 1.9 |
Skull | 10.00 | $5.00 | 2.0 |
Jackolantern | 20.00 | $10.00 | 2.0 |
Witch mask | 5.00 | $3.00 | 1.7 |
Goblin mask | 10.00 | $3.00 | 3.3 |
Trump mask | 15.00 | $3.00 | 5.0 |
Gene.prototype.calcFitness = function() {
var selectedItems = items.filter(getItem);
this.fitness = selectedItems.reduce(sumPoints, 0);
this.totalCost = selectedItems.reduce(sumCost, 0);
//set penalty if totalCost > costlimit
if (this.totalCost > costlimit) {
this.fitness -= Math.pow(costlimit - this.totalCost,2);
this.fitness = Math.min(this.fitness,population.bestFitnessSoFar-1);
if(this.fitness<0)
this.fitness=0;
}
}
The best solution is 51 scare points
Goldberg's classic text is still a valuable resource for the Genetic Algorithm [Goldberg1989], and Holland's text is interesting for those looking to learn about the research into adaptive systems that became the Genetic Algorithm [Holland1975]. Additionally, the seminal work by Koza should be considered for those interested in Genetic Programming [Koza1992], and Schwefel's seminal work should be considered for those with an interest in Evolution Strategies [Schwefel1981]. For an in-depth review of the history of research into the use of simulated evolutionary processed for problem solving, see Fogel [Fogel1998] For a rounded and modern review of the field of Evolutionary Computation, Bäck, Fogel, and Michalewicz's two volumes of "Evolutionary Computation" are an excellent resource covering the major techniques, theory, and application specific concerns [Baeck2000] [Baeck2000a]. For some additional modern books on the unified field of Evolutionary Computation and Evolutionary Algorithms, see De Jong [Jong2006], a recent edition of Fogel [Fogel1995], and Eiben and Smith [Eiben2003].
[from Clever Algorithms]Generate + Evolve
Genolve
Basic concepts
Make a blog graphic
(try clicking the 'geometric' button then click a design on the right)
Time flies like an arrow
NP : Determiner + Pre-modifiers + NOUN + Postmodifiers/Complement
Backus Normal Form (BNF)
<postal-address> ::= <name-part> <street-address> <zip-part>
<name-part> ::= <personal-part> <last-name> <opt-suffix-part> <EOL>
| <personal-part> <name-part>
<personal-part> ::= <letter> "." | <first-name>
<street-address> ::= <house-num> <street-name> <opt-apt-num> <EOL>
<zip-part> ::= <town-name> "," <state-code> <ZIP-code> <EOL>
<opt-suffix-part> ::= "Sr." | "Jr." | <roman-numeral> | ""
<opt-apt-num> ::= <apt-num> | ""
<first-name> ::= <word>
<word> ::= <letter><word> | <letter>
<letter> ::= "a"|"b"|"c"|"d"|"e"|"f"|"g"|"h"|"i"|"j"|"k"|"l"|"m"|"n"|"o"|"p"|"q"|"r"|"s"|"t"|"u"|"v"|"w"|"x"|"y"|"z"
Start Symbol • Production Rule • Choice • Terminal
To solve the Sante Fe Ant Trail
<prog> ::= <code>
<code> ::= <line> | <code> <line>
<line> ::= <condition>'\n' | <op>'\n'
<condition> ::= 'if(food_ahead()==1) {' <opcode> '} else {' <opcode> '}'
<op> ::= 'left();' | 'right();' | 'move();'
<opcode> ::= <op> | <opcode> <op>
left(); move(); if(food_ahead()==1) { right(); } else { move(); move(); right(); move(); }
Weighted Extended Backus Normal Form (EBNF) of over 2000 lines models the full SVG specification.
Timecount_list : Timecount_val ( '; ' Timecount_val )*5;
Timecount_val : float_datatype (Metric)?20;
Metric : 's'^80 |'min'^10 | 'h'^5 | 'ms'^5;
Radial Gradient
<radialGradient id='grad1' cx='60%' cy='80%' r='90%'
spreadMethod='pad' gradientUnits='objectBoundingBox'>
<stop offset='0' stop-color='hsl(34, 58%, 57%)' />
<stop offset='0.7' stop-color='hsl(214, 58%, 70%)' />
</radialGradient>
Radial Gradient in Tracery notation
gradient : "<radialGradient id='grad1' cx='#digit#0%' cy='#digit#0%' r='#digit#0%' spreadMethod='#spread#' gradientUnits='objectBoundingBox'>
<stop offset='0' stop-color='#svgColor#' />
<stop offset='0.#largeDigit#' stop-color='#svgColor#' />
</radialGradient>"
largeDigit : ["5","6","7","8","9"],
digit : ["1","2","3","4","5","6","7","8","9","0"],
r255Start : ["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"],
r255 : "#r255Start##digit#",
spread : ["repeat","pad","reflect"],
svgColor : "hsl(#r255#, #largeDigit##digit#%, #largeDigit##digit#%)",
[If you make something in Tracery load it on Genolve!]
Michael O'Neill, University College Dublin, and Conor Ryan, University of Limerick, have a wealth of books and papers.
Google's SketchRNN, an RNN trained on thousands of human sketches, can generate new sketches from a 'latent vector', the essence of a sketch.
Avoid using humans as your fitness function!
A GAN Discriminator as a Fitness Function
Each shape, no matter now similar, must travel its own evolutionary path.
Learn a 'latent chromosome'
Chromosome style transfer
Grammatical evolution gives you a parse tree for free
Possible parallels with NLP
Enquiries welcome
Use these backgrounds for your own slides!
Watch Twitter