Ejemplo n.º 1
0
        public Object Clone()
        {
            IntChromosome chromosome = new IntChromosome();

            chromosome.Gens = new List <int>(Gens);
            return(chromosome);
        }
        private void GeneratePopulation()
        {
            int        countOfIntValsForGen = Coder.GetCountOfIntValsForGen(range);
            List <int> gens = new List <int>(paramsCount);

            chromosomes.AsParallel().ForAll((chromosome) =>
            {
                chromosome = new IntChromosome();
                gens.AsParallel().ForAll(val => val = random.Next(countOfIntValsForGen + 1));
                chromosome.Gens = gens;
            });

            /*foreach (IntChromosome chromosome in chromosomes)
             * {
             *  chromosome = new IntChromosome();
             *  gens.AsParallel().ForAll(val => val = random.Next(countOfIntValsForGen + 1));
             *  chromosome.gens = gens;
             * }*/
        }