xegaGaCrossoverFactory: Configure the crossover function of a genetic algorithm.

View source: R/xegaGaCrossover.R

xegaGaCrossoverFactoryR Documentation

Configure the crossover function of a genetic algorithm.

Description

xegaGaCrossoverFactory() implements the selection of one of the crossover functions in this package by specifying a text string. The selection fails ungracefully (produces a runtime error) if the label does not match. The functions are specified locally.

Current support:

  1. Crossover functions with two kids:

    1. "Cross2Gene" returns xegaGaCross2Gene().

    2. "UCross2Gene" returns xegaGaUCross2Gene().

    3. "UPCross2Gene" returns xegaGaUPCross2Gene().

  2. Crossover functions with one kid:

    1. "CrossGene" returns xegaGaCrossGene().

    2. "UCrossGene" returns xegaGaUCrossGene().

    3. "UPCrossGene" returns xegaGaUPCrossGene().

Usage

xegaGaCrossoverFactory(method = "Cross2Gene")

Arguments

method

A string specifying the crossover function.

Details

Crossover operations which return 2 kids preserve the genetic material in the population. However, because we work with fixed size populations, genes with 2 offsprings fill two slots in the new population with their genetic material.

Value

A crossover function for genes.

See Also

Other Configuration: lFxegaGaGene, xegaGaGeneMapFactory(), xegaGaMutationFactory(), xegaGaReplicationFactory()

Examples

XGene<-xegaGaCrossoverFactory("Cross2Gene")
gene1<-xegaGaInitGene(lFxegaGaGene)
gene2<-xegaGaInitGene(lFxegaGaGene)
XGene(gene1, gene2, lFxegaGaGene)

xegaGaGene documentation built on April 16, 2025, 5:11 p.m.