xegaGaReplicate2Gene {xegaGaGene} | R Documentation |
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 of crossrate
).
If the check is TRUE
:
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.
xegaGaReplicate2Gene(pop, fit, lF)
pop |
A population of binary genes. |
fit |
Fitness vector. |
lF |
The local configuration of the genetic algorithm. |
A list of either 1 or 2 binary genes.
Other Replication:
xegaGaReplicateGene()
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)