Exemplo n.º 1
0
        public override Gene GenerateGene(int geneIndex)
        {
            Random rand = new Random();


            PixSwitch piswi = new PixSwitch();
            bool      s     = rand.Next(0, 2) == 0;

            piswi.Switch = s;//s == 0 ? false : true;

            return(new Gene(piswi));
        }
Exemplo n.º 2
0
        public StructuralChromosome(int numPixels)
            : base(numPixels)
        {
            _numPixels = numPixels;

            //int s = RandomizationProvider.Current.GetInt(0, 1);
            Random rand = new Random();


            for (int i = 0; i < numPixels; i++)
            {
                PixSwitch piswi = new PixSwitch();


                bool s = rand.Next(0, 2) == 0;

                piswi.Switch = s;
                ReplaceGene(i, new Gene(piswi));
            }
        }