예제 #1
0
        public IList<IGenom> Mutation(IGenom[] entities)
        {
            var result = new List<IGenom>(entities);

            foreach (var entity in entities.OfType<BinaryGenom>())
            {
                string x_mutant = BinaryСhromosome.Mutate(entity.X.Code);
                string y_mutant = BinaryСhromosome.Mutate(entity.Y.Code);
                if (x_mutant != null || y_mutant != null)
                {
                    result.Add(new BinaryGenom(
                        x_mutant == null
                            ? entity.X
                            : new BinaryСhromosome(x_mutant),
                        y_mutant == null
                            ? entity.Y
                            : new BinaryСhromosome(y_mutant),
                        EntityType.Mutant));
                }
            }
            return result;
        }
예제 #2
0
 public IList<IGenom> NexGeneration(IGenom partner)
 {
     var binatyPartner = (BinaryGenom)partner;
     var entities = Crossig(binatyPartner.Code);
     return Mutation(entities);
 }