---
title: Evolve
date: 2005-01-07T11:51:21Z
modified: 2005-01-07T11:51:21Z
permalink: "https://dogwonder.co.uk/2005/01/evolve/"
type: post
status: publish
excerpt: ""
wpid: 115
categories:
  - General
tags:
  - Evolution
---

\* Create an initial population of randomly-generated individuals
\* Evaluate each member’s fitness (“fitness” depends entirely on the task in hand; a member’s fitness might be how many 1s its genes contain, or how well it plays chess using its genes as “weights” for various evaluation parameters)
\* Kill the bottom x% (least fit) of the population (often 50%)
\* Let the fittest members breed (“reproduction”):
Choose two members for breeding (“selection”) – lots of variations here: e.g. either select two at random (“uniform”), or weight the selection according to a member’s fitness (“fitness-proportionate”)
\* Breed them (“crossover” – more options here: e.g., a child can be formed by single-point crossover (the parents’ genes are swapped over at some random point along their chromosome), two-point crossover (the parents’ genes are swapped over at two random points), uniform crossover (the parents’ genes are selected bit-by-bit randomly), and weighted crossover (the parents’ genes are selected bit-by-bit randomly but weighted according to each parents’ fitness)
\* Apply mutation – each gene of the child is subject to a small chance of mutating to a different allele (an allele is a possible value for a gene, in binary, the alleles are “0” and “1”) – a common mutation rate is 0.001
\* The children form the new population of members
\* Go to step 2 until you’ve evolved a suitably fit member or population

Crossover rate = 0: no crossover
Crossover rate = 0.7: “normal” crossover
Crossover rate = 1: crossover always applies

Mutation = 0: no mutation
Mutation = 0.001: “normal” mutation
Mutation = 0.05: high mutation

[String Length: 64
Population: 10
Crossover rate: 0.9
Number of Generations: 5
Mutation: 0.001](http://www.koncretedesign.co.uk/dogwonder/ga.php?stringLength=64&popSize=10&crossRate=0.9&selectType=rouletteWheelSelection&genCount=5&debugFlag=0&formFlag=)