selectionRoulette

@JvmName(name = "selectionRouletteFitDouble")
fun <V> selectionRoulette(source: Array<Chromosome<V, Double>>, totalFitness: Double, random: Random): Chromosome<V, Double>
@JvmName(name = "selectionRouletteFitFloat")
fun <V> selectionRoulette(source: Array<Chromosome<V, Float>>, totalFitness: Float, random: Random): Chromosome<V, Float>
@JvmName(name = "selectionRouletteFitInt")
fun <V> selectionRoulette(source: Array<Chromosome<V, Int>>, totalFitness: Long, random: Random): Chromosome<V, Int>
@JvmName(name = "selectionRouletteFitLong")
fun <V> selectionRoulette(source: Array<Chromosome<V, Long>>, totalFitness: Long, random: Random): Chromosome<V, Long>
@JvmName(name = "selectionRouletteFitShort")
fun <V> selectionRoulette(source: Array<Chromosome<V, Short>>, totalFitness: Long, random: Random): Chromosome<V, Short>
@JvmName(name = "selectionRouletteFitByte")
fun <V> selectionRoulette(source: Array<Chromosome<V, Byte>>, totalFitness: Long, random: Random): Chromosome<V, Byte>

Executes roulette selection. It is assumed that all individuals are "placed" on the roulette wheel.

For example, if you have 4 individuals with fitness 1, 2, 3, and 4, each of them will have its own "share" of the total 10 (1/10, 2/10, 3/10, and 4/10). A random number is generated between 0 and the total fitness (e.g. 10). The roulette wheel is spun and the random number "falls" on a sector, which corresponds to one of the individuals that will be selected.

Parameters

source

the population of Chromosomes

totalFitness

the sum of all fitness values in a population