mate: Returns the parents population and the corresponding fitness...

Description Usage Arguments Examples

View source: R/mate.R

Description

Returns the parents population and the corresponding fitness values

Usage

1
mate(methodFun, methodArgs)

Arguments

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

Examples

 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))

dchen49/GA documentation built on May 3, 2019, 6:43 p.m.