next up previous

5.1 Variable Genome Length

The first optimization is based on the observation that combining two homozygous wild loci will always produce a child that is homozygous wild at that locus. Any time the simulator is calling the random number generator and combining random bits from two homozygous wild parents it is wasting its time, because the result of combining two parents whose genes are all 0s will be offspring whose genes are all 0s. What we would like to do is concentrate CPU resources only on those portions of the genome for which some individual is heterozygous or a homozygous mutant, i.e. sections of the genome where we can find bits that are 1s.

The ``free locus pointer'' ( flp) described in section 4.2.3 is the key to focussing only on portions of the genome that contain mutations, as shown in Figure 3.

Figure 3: A population of four individuals with an overall genome length of 48 loci, implemented on a computer with 16-bit words. Mutations are inserted from the left, with the next mutation going into the locus pointed to by the "free locus pointer" (flp). All loci to the right of this pointer (green shaded region) are wild, so all individuals are homozygous wild. The blue shaded regions show mutations introduced into the current generation (1, 1, 3, and 2 mutations, respectively). The unshaded region to the left contains segregating loci introduced in previous generations.