Example #17 and adding Biased Crossover
----- By John Escobar & Tom Kiehl
Example #17 uses a 2DArrayAlleleGenome with 3 alleles and
uses the GA to create an array with alternating 0's and 1's
with -1 at the corners.
Our primary concern was not with the content of the arrays but more with how
crossover occured. We wanted to bias the crossover so that it never divided
the X-axis up. Our reasons for doing this is because in our larger project
we will have to limit crossover in the same way.
Figure 1 shows how example 17 originally performed crossover. We took the
crossover function and redefined it so that it would perform crossover in
the way that we wanted as seen in Figure 2.
In this particular example, changing how crossover occurs slightly lowered
the fitness of the developing gene pool. As shown in Figure 3.
Things we learned and took from this example and others:
- Example 17 - we gutted ex17 for our
CryptoQuote project
- Used its Arrays (we changed the 2DArrayAlleleGenome to a 1DArrayAlleleGenome)
- Used its alleles (we increased the alleles from 3 to 26)
- Put excellent use to the overriding io function so that one can easily
cout the genome and actually get the cryptoquote
- Example 12 - we loved how ex12 handled unique alleles
- Used its initializer to initialize our population to all unique alleles -
genome.initializer(AlphabetInitializer);
- Used its swap mutator to swap while maintaining unique alleles-
genome.mutator(GAStringSwapMutator);
- Used its partial match crossover to crossover and maintain unique alleles -
ga.crossover(GAStringPartialMatchCrossover);
- Example 7 - we grabbed its steady-state GA to replace our simple one
Modified Source Code:
Back to GA Page