Beispiel #1
0
        public Population(
            int length,
            int crossOverPoint,
            int initialPop,
            int popLimit,
            float mutationFreq,
            float deathParam,
            float reproductionParam,
            float[] weights)
        {
            this.m_length                 = length;
            this.m_crossoverPoint         = crossOverPoint;
            this.m_initialPopulationCount = initialPop;
            this.m_populationLimit        = popLimit;
            this.m_mutationFreq           = mutationFreq;
            this.m_deathParam             = deathParam;
            this.m_reproduceParam         = reproductionParam;

            this.m_genomes = new List <BasketListGenome>();

            for (int i = 0; i < this.m_initialPopulationCount; i++)
            {
                BasketListGenome newGenome = new BasketListGenome(this.m_length);
                newGenome.CrossoverPoint = this.m_crossoverPoint;
                newGenome.FitnessFunction();
                newGenome.SetWeights(weights);

                this.m_genomes.Add(newGenome);
            }
        }