Learn R Programming

xegaGaGene (version 1.0.0.4)

xegaGaCross2Gene: One point crossover of 2 genes.

Description

xegaGaCross2Gene() randomly determines a cut point. It combines the bits before the cut point of the first gene with the bits after the cut point from the second gene (kid 1). It combines the bits before the cut point of the second gene with the bits after the cut point from the first gene (kid 2). It returns 2 genes.

Usage

xegaGaCross2Gene(gg1, gg2, lF)

Value

A list of 2 binary genes.

Arguments

gg1

A binary gene.

gg2

A binary gene.

lF

The local configuration of the genetic algorithm.

See Also

Other Crossover (Returns 2 Kids): xegaGaUCross2Gene(), xegaGaUPCross2Gene()

Examples

Run this code
gene1<-xegaGaInitGene(lFxegaGaGene)
gene2<-xegaGaInitGene(lFxegaGaGene)
xegaGaDecodeGene(gene1, lFxegaGaGene)
xegaGaDecodeGene(gene2, lFxegaGaGene)
newgenes<-xegaGaCross2Gene(gene1, gene2, lFxegaGaGene)
xegaGaDecodeGene(newgenes[[1]], lFxegaGaGene)
xegaGaDecodeGene(newgenes[[2]], lFxegaGaGene)

Run the code above in your browser using DataLab