public override BaseGenome CreateRandom() { GenomeBinaryString random = new GenomeBinaryString(Length); for (int i = 0; i < random.Length; i++) { random.Set(i, Random.value < 0.5f); } return random; }
public override void CloneFrom(BaseGenome source) { GenomeBinaryString s = source as GenomeBinaryString; for (int i = 0; i < bits.Length; i++) { bits[i] = s.bits[i]; } }
public override void OnePointCrossover(BaseGenome mom, BaseGenome dad, int point) { GenomeBinaryString m = mom as GenomeBinaryString; GenomeBinaryString d = dad as GenomeBinaryString; for (int i = 0; i < bits.Length; i++) { bits[i] = (i < point ? m : d).bits[i]; } }
public override BaseGenome CreateRandom() { GenomeBinaryString random = new GenomeBinaryString(Length); for (int i = 0; i < random.Length; i++) { random.Set(i, Random.value < 0.5f); } return(random); }