| cross {adana} | R Documentation |
Crossover
Description
It is a wrapper function that calls crossover operators from a single function.
Usage
cross(crossfunc, matpool, cxon, cxpc, gatype, ...)
Arguments
crossfunc |
The name of the crossover operator |
matpool |
A matrix. Mating pool containing selected individuals. |
cxon |
Number of offspring to be generated as a result of crossover |
cxpc |
Crossover Ratio. Default value is 0.95 |
gatype |
Indicates the GA type. "gga" is assigned for generational refresh, and "ssga" for steady-state refresh. |
... |
Further arguments passed to or from other methods. |
Value
A matrix containing the generated offsprings.
Author(s)
Zeynel Cebeci & Erkut Tekeli
References
Cebeci, Z. (2021). R ile Genetik Algoritmalar ve Optimizasyon Uygulamalari, 535 p. Ankara:Nobel Akademik Yayincilik.
See Also
px1,
kpx,
sc,
rsc,
hux,
ux,
ux2,
mx,
rrc,
disc,
atc,
cpc,
eclc,
raoc,
dc,
ax,
hc,
sax,
wax,
lax,
bx,
ebx,
blxa,
blxab,
lapx,
elx,
geomx,
spherex,
pmx,
mpmx,
upmx,
ox,
ox2,
mpx,
erx,
pbx,
pbx2,
cx,
icx,
smc
Examples
genpop = initbin(12,8) #Initial population
m = ncol(genpop)-2 #Number of Gene
sumx = function(x, ...) (sum(x)) #Fitness Function
fitvals = evaluate(fitfunc=sumx, genpop[,1:m]) #Fitness Values
genpop[,"fitval"] = fitvals
selidx = select(selfunc=selrws, fitvals) #Selection of Parents
matpool = genpop[selidx,] #Mating Pool
offsprings = cross(crossfunc=px1, matpool=matpool, #Crossing
cxon=2, cxpc=0.8, gatype="gga")
offsprings
offsprings = cross(crossfunc=kpx, matpool=matpool,
cxon=2, cxpc=0.8, gatype="ssga", cxps=0.5, cxk=2)
offsprings