示例#1
0
        public virtual TChromosome Cross(TChromosome other, int splitIdx)
        {
            var child = new TChromosome();

            Array.Copy(Genes, 0, child.Genes, 0, splitIdx);
            Array.Copy(
                other.Genes,
                splitIdx + 1,
                child.Genes,
                splitIdx + 1,
                other.Genes.Length - splitIdx - 1
                );
            return(child);
        }
示例#2
0
        public override TChromosome Cross(TChromosome other, int splitIdx)
        {
            var child = new RubikGenome();

            Array.Copy(Genes, 0, child.Genes, 0, splitIdx);
            Array.Copy(
                other.Genes,
                splitIdx + 1,
                child.Genes,
                splitIdx + 1,
                other.Genes.Length - splitIdx - 1
                );

            child.Correct();

            return(child);
        }