/// <summary>
        /// Construct a genetic algorithm for a neural network that uses training sets.
        /// </summary>
        /// <param name="network">The neural network.</param>
        /// <param name="reset">Should each neural network be reset to random values.</param>
        /// <param name="input">The input training set.</param>
        /// <param name="ideal">The ideal values for the input training set.</param>
        /// <param name="populationSize">The initial population size.</param>
        /// <param name="mutationPercent">The mutation percentage.</param>
        /// <param name="percentToMate">The percentage of the population allowed to mate.</param>
        public TrainingSetNeuralGeneticAlgorithm(FeedforwardNetwork network,
                                                 bool reset, double[][] input,
                                                 double[][] ideal, int populationSize,
                                                 double mutationPercent, double percentToMate)
        {
            this.MutationPercent  = mutationPercent;
            this.MatingPopulation = percentToMate * 2;
            this.PopulationSize   = populationSize;
            this.PercentToMate    = percentToMate;

            this.input = input;
            this.ideal = ideal;

            this.Chromosomes = new TrainingSetNeuralChromosome[this.PopulationSize];
            for (int i = 0; i < this.Chromosomes.Length; i++)
            {
                FeedforwardNetwork chromosomeNetwork = (FeedforwardNetwork)network
                                                       .Clone();
                if (reset)
                {
                    chromosomeNetwork.Reset();
                }

                TrainingSetNeuralChromosome c = new TrainingSetNeuralChromosome(
                    this, chromosomeNetwork);
                c.UpdateGenes();
                SetChromosome(i, c);
            }
            SortChromosomes();
        }
        /// <summary>
        /// Construct a genetic algorithm for a neural network that uses training sets.
        /// </summary>
        /// <param name="network">The neural network.</param>
        /// <param name="reset">Should each neural network be reset to random values.</param>
        /// <param name="input">The input training set.</param>
        /// <param name="ideal">The ideal values for the input training set.</param>
        /// <param name="populationSize">The initial population size.</param>
        /// <param name="mutationPercent">The mutation percentage.</param>
        /// <param name="percentToMate">The percentage of the population allowed to mate.</param>
        public TrainingSetNeuralGeneticAlgorithm(FeedforwardNetwork network,
                 bool reset, double[][] input,
                 double[][] ideal, int populationSize,
                 double mutationPercent, double percentToMate)
        {

            this.MutationPercent = mutationPercent;
            this.MatingPopulation = percentToMate * 2;
            this.PopulationSize = populationSize;
            this.PercentToMate = percentToMate;

            this.input = input;
            this.ideal = ideal;

            this.Chromosomes = new TrainingSetNeuralChromosome[this.PopulationSize];
            for (int i = 0; i < this.Chromosomes.Length; i++)
            {
                FeedforwardNetwork chromosomeNetwork = (FeedforwardNetwork)network
                       .Clone();
                if (reset)
                {
                    chromosomeNetwork.Reset();
                }

                TrainingSetNeuralChromosome c = new TrainingSetNeuralChromosome(
                       this, chromosomeNetwork);
                c.UpdateGenes();
                SetChromosome(i, c);
            }
            SortChromosomes();
        }