randomly Crossover
inline suspend fun <V, F> PanmicticEvolveScope<V, F>.randomlyCrossover(chance: Double, parallelismLimit: Int, crossinline crossover: suspend (chromosome1: Chromosome<V, F>, chromosome2: Chromosome<V, F>, random: Random) -> Unit)
Executes CrossoverType.Randomly crossing.
Example:
val elitism = 2
Population before: 0, 1, 2, 3, 4, 5, 6
Iteration 1 (cross indices = 2, 3):
firstParentIndex = 1
secondParentIndex = 4
Result: [1-4], [4-1]
Iteration 2 (cross indices = 4, 5):
firstParentIndex = 1
secondParentIndex = 2
Result: [1-2], [2-1]
Population after: 0, 1, [1-4], [4-1], [1-2], [2-1], 6
Content copied to clipboard
Parameters
chance
chance of crossover between a pair of chromosomes
parallelism Limit
limit of parallel workers
crossover
specific crossing action (How chromosomes will be crossed)