Ejemplo n.º 1
0
        protected override IPhenotype CreateRandomPhenotype()
        {
            CreateRandomPhenotypeCount++;
            var geno = new BinaryGenotype(bits);

            return(new TestPhenotype(geno));
        }
Ejemplo n.º 2
0
        protected override IPhenotype CreateRandomPhenotype()
        {
            var g = new BinaryGenotype(_bitcount);

            for (int i = 0; i < _bitcount; i++)
            {
                g.Bits[i] = RNG.NextBool();
            }
            var p = new LOLZPhenotype(g, _z);

            return(p);
        }
Ejemplo n.º 3
0
        protected override IPhenotype CreateRandomPhenotype()
        {
            BinaryGenotype g = new BinaryGenotype(_bitcount);

            for (int i = 0; i < _bitcount; i++)
            {
                g.Bits[i] = RNG.NextBool();
            }
            OneMaxPhenotype p = new OneMaxPhenotype(g);

            return(p);
        }
Ejemplo n.º 4
0
        protected override double CalculateFitness()
        {
            BinaryGenotype geno = (BinaryGenotype)Genotype;

            onecount = 0;
            values   = new int[geno.Bits.Count];
            for (int i = 0; i < values.Length; i++)
            {
                values[i] = geno.Bits[i] ? 1 : 0;
                onecount += geno.Bits[i] ? 1 : 0;
            }

            int value = 0;

            foreach (int n in values)
            {
                value += n;
            }

            return(value / (double)values.Length);
        }