Ejemplo n.º 1
0
 public Organism(IChromosome cs, float fitness)
 {
     GeneticUtil.CHECKNULLARG(cs);
     this.m_chromosome = cs;
     this.Fitness      = fitness;
     this.ID           = Organism.generator.GetUniqueID();
     this.GenerationID = -1;
 }
Ejemplo n.º 2
0
        public void AddOrganism(Organism p0)
        {
            GeneticUtil.CHECKNULLARG(p0);

            if (this.IsFull)
            {
                throw new GeneticError("Cannot add an organism to a full population");
            }

            this.organisms.Add(p0);
        }
Ejemplo n.º 3
0
        public void Crossover(Organism parent0, Organism parent1, out Organism child0, out Organism child1)
        {
            child0 = parent0.Clone();
            child1 = parent1.Clone();

            int left;
            int right;

            GeneticUtil.PickCrossOverPoints(parent0.Genes, out left, out right);
            child0.Genes.SwapGenesBetween(left, right, child1.Genes);
        }