Description Usage Arguments Details Value Examples
Generates a list of parents to breed with the first parents selected. Makes sure that a parent is not breeding with itself. Called within the Breed() function
1 | getSecondParents(firstParents, method, nPop, relScore)
|
firstParents |
List of the first parents in each mating. |
method |
One of two scoring methods to determine the second parent.
|
nPop |
Number of chromosomes in the population. Equal to the length of firstParents. |
relScore |
Relative fitness score as calculated by Fitness(). Lower is better. |
This function ensures that the second parent in a crossover is distinct from the first. It uses one of two methods to determine the second parent. This will be slower than randomly picking the second parent but could provide better performance. Function assumes that the worse member of the previous generation has already been removed.
A vector indicating the row position in the population matrix of the parents that will breed with the firstParents vector.
1 2 3 4 5 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.