示例#1
0
        public void SwapGenesBetween(int first_index, int last_index, geneticfx.IChromosome other_chromosome)
        {
            MyChromosome ocs = (MyChromosome)other_chromosome;

            for (int i = first_index; i <= last_index; i++)
            {
                MyGene swap = (MyGene)this.genes[i];
                this.genes[i] = ocs.genes[i];
                ocs.genes[i]  = swap;
            }
        }
示例#2
0
        public void SwapGenesBetween(int first_index, int last_index, geneticfx.IChromosome other_chromosome)
        {
            // swap genes between two chromosomes
            MyChromosome ocs = (MyChromosome)other_chromosome;

            for (int i = first_index; i <= last_index; i++)
            {
                bool swap = this.genes[i];
                this.genes[i] = ocs.genes[i];
                ocs.genes[i]  = swap;
            }
        }