View source: R/xegaGpCrossover.R
xegaGpFilterCrossGene | R Documentation |
xegaGpFilterCrossGene()
swaps two randomly extracted
subtrees between 2 genes. Subtrees must have the same
root in order to be compatible. The current implementation
performs at most lF$MaxTrials()
attempts to find compatible
subtrees. If this fails, the original gene is returned.
Only nodes with a depth
between lF$MinMutInsertionDepth()
and
lF$MaxMutInsertionDepth()
are considered as
candidate roots of derivation trees to be swapped
by crossover.
xegaGpFilterCrossGene(ng1, ng2, lF)
ng1 |
Derivation tree. |
ng2 |
Derivation tree. |
lF |
Local configuration of the genetic algorithm. |
Crossover is controlled by three local parameters:
lF$MinCrossDepth()
and
lF$MaxCrossDepth()
control the possible exchange points
for subtrees. The depth of the exchange node must be
between lF$MinMutInsertionDepth()
and
lF$MaxMutInsertionDepth()
.
lF$MaxTrials()
: Maximal number of trials to find
compatible subtrees. If compatible subtrees are not
found, the gene is returned unchanged.
List of 1 derivation tree.
Other Crossover:
xegaGpAllCross2Gene()
,
xegaGpAllCrossGene()
,
xegaGpFilterCross2Gene()
gene1<-xegaGpInitGene(lFxegaGpGene)
gene2<-xegaGpInitGene(lFxegaGpGene)
xegaGpDecodeGene(gene1, lFxegaGpGene)
xegaGpDecodeGene(gene2, lFxegaGpGene)
newgene<-xegaGpFilterCrossGene(gene1, gene2, lFxegaGpGene)
xegaGpDecodeGene(newgene[[1]], lFxegaGpGene)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.