protected override IPhenotype CreateRandomPhenotype() { CreateRandomPhenotypeCount++; var geno = new BinaryGenotype(bits); return(new TestPhenotype(geno)); }
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); }
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); }
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); }