/// <summary>
 /// Initializes a new instance of the <see cref="T:Accord.Genetic.ShortArrayChromosome" /> class.
 /// </summary>
 /// <param name="source">Source chromosome to copy.</param>
 /// <remarks><para>This is a copy constructor, which creates the exact copy
 /// of specified chromosome.</para></remarks>
 protected SerializableChromosome(SerializableChromosome source)
 {
     this.length   = source.length;
     this.maxValue = source.maxValue;
     this.val      = (ushort[])source.val.Clone();
     this.fitness  = source.fitness;
 }
        /// <summary>Crossover operator.</summary>
        /// <param name="pair">Pair chromosome to crossover with.</param>
        /// <remarks><para>The method performs crossover between two chromosomes – interchanging
        /// range of genes (array elements) between these chromosomes.</para></remarks>
        public override void Crossover(IChromosome pair)
        {
            SerializableChromosome shortArrayChromosome = (SerializableChromosome)pair;

            if (shortArrayChromosome == null || shortArrayChromosome.length != this.length)
            {
                return;
            }
            int num    = Generator.Random.Next(this.length - 1) + 1;
            int length = this.length - num;

            ushort[] numArray = new ushort[length];
            Array.Copy((Array)this.val, num, (Array)numArray, 0, length);
            Array.Copy((Array)shortArrayChromosome.val, num, (Array)this.val, num, length);
            Array.Copy((Array)numArray, 0, (Array)shortArrayChromosome.val, num, length);
        }