Description Usage Arguments Details Value Examples
Uses the tournament method to generate a list of parents to be used in crossover. Tournament size used is k=2. It is called within Breed function.
1 | tournamentSelection(population=population, scores=scores, nPop=nPop)
|
population |
current chromosome population as a matrix with each row representing a chromosome and each value indicating the presence (1) or absence (0) of a specific trait |
scores |
scores for the current chromosomes in the population a lower score is better |
nPop |
current number of chromosomes in the population If you do not remove the worst chromosome before using You could set this to nPop1 to get results |
The function generates a list of parents using the tournament method with size 2. The current population is broken into groups of 2 (if it is odd one member is randomly selected to sit out the tournament). For each group of 2 chromosomes the one with the lowest score is chose as a parent. This is repeated until the desired number of parents ((nPop-1)*2) has been generated.
A vector indicating the row positions in the population matrix of the parents that will be bred using Crossover.
1 2 3 4 5 6 7 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.