Description Usage Arguments Details Value Examples
Breed the Selected Parents Generated From GA::selection()
1 | nextGeneration(pop, selResult, G)
|
pop |
boleans matrix determined by |
selResult |
list returnd by |
offspringNum |
number of offspring generated to update the generation. |
Breeding uses GA::crossover()
for each pair of parents. The
Generation Gap G is the proportion of the generation to be replaced by
generated offspring. If the number of the selected population produced by
generation gap is not an even number, choose the nearest bigger even number.
Uses the offspringNum number of offspring to replace the least fit
individuals in parent generation
Returns a C by P maatrix containing the population for the next generation.
1 2 3 4 5 6 7 8 9 10 11 12 | dat <- mtcars
C <- ncol(dat) - 1
P <- as.integer(1.5 * C)
pop <- initialization(C, P)
fitnessFunction <- AIC
model <- lm
y <- as.matrix(dat[1])
X <- as.matrix(dat[-1])
fitScores <- fitness(pop, y, X, fitnessFunction, model, dat)
offspringNum <- 4
selResult <- selection(pop, fitnessFunction, model, fitScores, offspringNum, method = 1, dat, K = 2)
nextGeneration(pop, selResult, offspringNum)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.