コード例 #1
0
 public override IGenotype ShallowCopy()
 {
     return(new CollectiveGenotype <T>(Genes.Length)
     {
         Genes = Genes.Clone() as byte[]
     });
 }
コード例 #2
0
 public override IGenotype ShallowCopy()
 {
     return(new UInt16Genotype(sizeof(ushort))
     {
         Genes = Genes.Clone() as byte[]
     });
 }
コード例 #3
0
 public override IGenotype ShallowCopy()
 {
     return(new Int32Genotype(sizeof(int))
     {
         Genes = Genes.Clone() as byte[],
     });
 }
コード例 #4
0
 public override IGenotype ShallowCopy()
 {
     return(new UInt64Genotype(sizeof(ulong))
     {
         Genes = Genes.Clone() as byte[],
     });
 }
コード例 #5
0
    public void Register(Genes genes)
    {
        foreach (Entry x in species)
        {
            float d = genes.Difference(x.genes);
            if (d < cSpeciesOffset)
            {
                // found it!
                x.count++;
                x.maxCount++;
                genes.species   = x.id;
                genes.isFounder = false;
                return;
            }
        }
        // a new species, hurray!
        Entry y = new Entry();

        y.id            = speciesId++;
        y.genes         = genes.Clone(); // can we have a clone plz?
        y.count         = 1;
        genes.species   = y.id;
        genes.isFounder = true;
        species.Add(y);
    }
コード例 #6
0
 public override IGenotype ShallowCopy()
 {
     return(new Float64Genotype(sizeof(double))
     {
         Genes = Genes.Clone() as byte[],
     });
 }
コード例 #7
0
    public void Mutate(Genes other)
    {
        Genes the_genes = other.Clone();

        the_genes.Mutate();
        Create(the_genes);
    }
コード例 #8
0
 public override TGenotype ShallowCopy <TGenotype>()
 {
     return(new OrderBasedGenotype(Count)
     {
         Value = (short[])Value.Clone(),
         Genes = Genes.Clone() as byte[]
     } as TGenotype);
 }