TransformSelect {xegaSelectGene}R Documentation

Convert a selection function into a continuation.

Description

TransformSelect precomputes the indices of genes to be selected and converts the selection function into an access function to the next index. The access function provides a periodic random index stream with a period length of the population size. In a genetic algorithm with a fixed size population, this avoids recomputation of the selection functions for each gene and its mate.

Usage

TransformSelect(fit, lF, SelectFUN)

Arguments

fit

Fitness vector.

lF

Local configuration.

SelectFUN

Selection function.

Details

The motivation for this transformation is:

  1. We avoid the recomputation of potentially expensive selection functions. E.g. In population-based genetic algorithms, the selection function is computed twice per generation instead of more than generation times the population size.

  2. No additional control flow is needed.

  3. Dynamic reconfiguration is possible.

  4. All selection functions have a common abstract interface and, therefore, can be overloaded by specialized concrete implementations. (Polymorphism).

The implementation idea is adapted from the continuation passing style in functional programming. See Reynolds, J. C. (1993).

Value

A function with a state which consists of the precomputed gene index vector, its length, and a counter. The function increments the counter in the state of its environment and returns the precomputed gene index at position modulo((counter+1),length) in the precomputed index vector in its environment. The function supports the same interface as a selection function.

Parallelization/Distribution

  1. We use this tranformation if only the evaluation of genes should be parallelized/distributed.

  2. If the complete replication of genes is parallelized, this transformation cannot be used in its current form. The current implementations of the selection functions can not easily be parallelized.

References

Reynolds, J. C. (1993): The discoveries of continuations. LISP and Symbolic Computation 6, 233-247. <doi:10.1007/BF01019459>

Examples

fit<-sample(10, 15, replace=TRUE)
newselect<-TransformSelect(fit, NewlFselectGenes(), SelectSUS) 
newselect(fit, NewlFselectGenes())
newselect(fit, NewlFselectGenes(), 5)
newselect(fit, NewlFselectGenes(), 10)
newselect(fit, NewlFselectGenes(), 10)

[Package xegaSelectGene version 1.0.0.0 Index]