/** * Creates a number of offspring by combining (using crossover) the current * Gene's chromosome with another Gene's chromosome. * Usually two parents will produce an equal amount of offpsring, although * in other reproduction strategies the number of offspring produced depends * on the fitness of the parents. * @param other: the other parent we want to create offpsring from * @return Array of Gene offspring (default length of array is 2). * These offspring will need to be added to the next generation. */ public override GeneAbstract <int>[] Reproduce(GeneAbstract <int> other) { GeneA[] offspring = new GeneA[2]; offspring[0].mChromosome = singlePointCrossover(other.mChromosome); offspring[1].mChromosome = singlePointCrossover(other.mChromosome); return(offspring); }
/** * Creates a number of offspring by combining (using crossover) the current * Gene's chromosome with another Gene's chromosome. * Usually two parents will produce an equal amount of offpsring, although * in other reproduction strategies the number of offspring produced depends * on the fitness of the parents. * @param other: the other parent we want to create offpsring from * @return Array of Gene offspring (default length of array is 2). * These offspring will need to be added to the next generation. */ public abstract GeneAbstract <BasicGeneType>[] Reproduce(GeneAbstract <BasicGeneType> other);