Description Usage Arguments Examples
Returns the parents population and the corresponding fitness values
1 | mate(methodFun, methodArgs)
|
methodFun |
a function of selection method, can be gaLRselection-linear selection, gaExpSelection-nonlinear selection, gaRWselection-Roulette Wheel selection, gaTNselection-Tournament selection |
methodArgs |
a list with elements as arguments of selection method function, where first element is population, second as fitness value, third as elite rate. If the chosen selection method is exponential ranking selection, then one more argument as exponential base must be provided; if the chosen selection method is tournament selection, then one more argument as number of random selections must be provided |
1 2 3 4 5 6 7 8 9 10 11 | numVar <- 6
N <- 50
population <- matrix(rbinom(numVar*N, 1, prob = 0.5), N, numVar)
fitnessVec <- seq(15, 50, length.out=50)
c <- 0.5
k <- 5
eliteRate <- 0.05
mate(gaLRselection, list(population, fitnessVec, eliteRate))
mate(gaExpSelection, list(population, fitnessVec, eliteRate, c))
mate(gaRWselection, list(population, fitnessVec, eliteRate))
mate(gaTNselection, list(population, fitnessVec, eliteRate, k))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.