xegaGaReplicate2Gene {xegaGaGene} | R Documentation |
Replicates a gene.
Description
xegaGaReplicate2Gene
replicates a gene
by applying a gene reproduction pipeline
which uses crossover and
mutation. The control flow is as follows:
A gene is selected from the population. Check if the crossover operation should be applied. (The check is
TRUE
with a probability ofcrossrate
). If the check isTRUE
:Select a mating gene from the population.
Perform the crossover operation.
Apply mutation with a probability of
mutrate
.Return a list with both genes.
Apply mutation with a probability of
mutrate
.Return a list with a single gene.
Usage
xegaGaReplicate2Gene(pop, fit, lF)
Arguments
pop |
A population of binary genes. |
fit |
Fitness vector. |
lF |
The local configuration of the genetic algorithm. |
Value
A list of either 1 or 2 binary genes.
See Also
Other Replication:
xegaGaReplicateGene()
Examples
lFxegaGaGene$CrossGene<-xegaGaCross2Gene
lFxegaGaGene$MutationRate<-function(fit, lF) {0.001}
names(lFxegaGaGene)
pop10<-lapply(rep(0,10), function(x) xegaGaInitGene(lFxegaGaGene))
epop10<-lapply(pop10, lFxegaGaGene$EvalGene, lF=lFxegaGaGene)
fit10<-unlist(lapply(epop10, function(x) {x$fit}))
newgenes<-xegaGaReplicate2Gene(pop10, fit10, lFxegaGaGene)
[Package xegaGaGene version 1.0.0.1 Index]