Learn R Programming

xegaPopulation (version 1.0.0.11)

AcceptBest: Accepts only genes with equal or better fitness.

Description

Change the gene by a genetic operator pipeline and return the new gene only if the new gene has at least the same fitness as the gene.

Usage

AcceptBest(OperatorPipeline, gene, lF)

Value

The new gene, if it is at least as fit as gene else the old gene gene.

Arguments

OperatorPipeline

Genetic operator pipeline.

gene

Gene.

lF

Local configuration.

Details

The fitness of genes never decreases. New genes with inferior fitness do not survive.

See Also

Other Acceptance Rule: AcceptIVMetropolis(), AcceptMetropolis(), AcceptNewGene()

Examples

Run this code
OPpipe1<-function(g, lF){InitGene(lF)}
g1<-lFxegaGaGene$EvalGene(InitGene(lFxegaGaGene), lFxegaGaGene)
g2<-AcceptBest(OPpipe1, g1, lFxegaGaGene)
identical(g1, g2)

Run the code above in your browser using DataLab