next up previous

4.1.2 Reproduction

In asexual reproduction, a child is an exact duplicate of its parent, and implementing reproduction in the computational model is trivial: we just need to copy the integer that represents the parent.

The main inner loop of the simulator will need to build up a new generation from the current generation. To do this, it will select individuals at random from the current generation and copy them to the new generation. Thus the simulator actually needs two arrays, one for each generation.

In the rest of this section, we will denote the current population by g and the ith individual in g by g[i]. We will use an array ng to hold the new generation.