xegaGpFilterCross2Gene {xegaGpGene} | R Documentation |
Crossover of 2 derivation tree genes with node filter.
Description
xegaGpFilterCross2Gene()
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 maxtrials
trials to find compatible
subtrees. If this fails, the original genes are 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.
Usage
xegaGpFilterCross2Gene(ng1, ng2, lF)
Arguments
ng1 |
Derivation tree. |
ng2 |
Derivation tree. |
lF |
Local configuration of the genetic algorithm. |
Details
Crossover is controlled by three local parameters:
-
lF$MinCrossDepth()
andlF$MaxCrossDepth()
control the possible exchange points for subtrees. The depth of the exchange node must be betweenlF$MinMutInsertionDepth()
andlF$MaxMutInsertionDepth()
. -
lF$MaxTrials()
: Maximal number of trials to find compatible subtrees. If compatible subtrees are not found, the gene is returned unchanged.
Value
List of 2 derivation trees.
See Also
Other Crossover:
xegaGpAllCross2Gene()
,
xegaGpAllCrossGene()
,
xegaGpFilterCrossGene()
Examples
gene1<-xegaGpInitGene(lFxegaGpGene)
gene2<-xegaGpInitGene(lFxegaGpGene)
xegaGpDecodeGene(gene1, lFxegaGpGene)
xegaGpDecodeGene(gene2, lFxegaGpGene)
newgenes<-xegaGpFilterCross2Gene(gene1, gene2, lFxegaGpGene)
xegaGpDecodeGene(newgenes[[1]], lFxegaGpGene)
xegaGpDecodeGene(newgenes[[2]], lFxegaGpGene)