xegaPopulation {xegaPopulation} | R Documentation |
Population level functions
The xegaPopulation
package provides the representation independent
functions of the population level of the simple genetic
algorithm xegaX packages:
File xegaPopulation.R:
Initializing a population of genes.
Getting the indices of the best genes in a population of genes for getting the best solution(s) in a population of genes.
Configurable summary report of population fitness statistics.
Observation of the summary statistics of a population of genes.
Logging of the phenotype and the value of the phenotype.
File xegaNextPopulation.R:
Computation of the next population of genes.
Evaluation of the next population of genes.
Future: Improved support for parallelization suggests a different division of labor:
Construct a list of abstract task descriptions with one element per gene.
Provide for a parallel execution of these task descriptions. This requires changes in the structuring of the operator pipelines and the replicate gene functions for the different gene representations and algorithms.
Performance improvement depends on the gene representation and on the use of function evaluations in the genetic machinery. For example, for the TSP problem, function evaluations are embedded into most of the mutation operators.
File acceptance.R: Acceptance rules for new genes and a function factory for configuring them.
File cooling.R: Cooling schedules for temperature reduction.
File localAdaptivity.R: Unused. Move to gene dependent packages planned.
File adaptivityCrossover.R: Functions constant and adaptive crossover rates.
File adaptivityMutation.R: Functions constant and adaptive mutation rates.
File parModel.R: Execution models for parallelization.
"Sequential": Configures lapply as lapply()
.
"MultiCore": Configures lapply as parallel::mclapply()
.
The number of cores is set by lF$Core()
.
File configuration.R: Documenting how the algorithm was called. Support for the replication of computational experiments (replicate and replay).
newGene<-accept(OperatorPipeline, gene, lF)
Accept all new genes: Identity function. For genetic algorithms.
Accept best: Accepts the gene with the highest fitness. For greedy and randomized greedy algorithms (hill-climbing algorithms).
The Metropolis and the individually variable Metropolis rule: If the new gene gene is better, accept it. If the old gene is better, make a biased random choice. The probability of accepting a decrease in fitness depends on the fitness distance between genes, a constant beta for scaling the exponential decay and a temperature parameter and for the individually variable Metropolis rule a correction term which depends on the distance to the best known fitness of the run.
Constants for Acceptance Rules.
Constant | Default | Used in |
lF$Beta() | ? | AcceptMetropolis() |
AcceptIVMetropolis() | ||
lF$TempK() | ? | AcceptMetropolis() |
AcceptIVMetropolis() | ||
lF$lFCBestFitness() | None | AcceptIVMetropolis() |
Temperature<-cooling(k, lF)
Cooling schedules convert the progress of the time in the algorithm (measured in generations) into a temperature. The temperature influences the probability of accepting a gene with less fitness than its parent gene.
Constants for Cooling Schedules.
Constant | Default | Used in |
lF$Alpha() | ? | ExponentialMultiplicativeCooling() |
? | LogarithmicMultiplicativeCooling() | |
? | PowerMultiplicativeCooling() | |
lF$Temp0() | ? | ExponentialMultiplicativeCooling() |
? | LogarithmicMultiplicativeCooling() | |
? | PowerMultiplicativeCooling() | |
? | PowerAdditiveCooling() | |
? | ExponentialAdditiveCooling() | |
? | TrigonometricAdditiveCooling() | |
lF$TempN() | ? | PowerAdditiveCooling() |
? | ExponentialAdditiveCooling() | |
? | TrigonometricAdditiveCooling() | |
lF$CoolingPower() | ? | PowerMultiplicativeCooling() |
? | PowerAdditiveCooling() | |
lF$Generations() | PowerAdditiveCooling() | |
ExponentialAdditiveCooling() | ||
? | TrigonometricAdditiveCooling() | |
rate<-rateFunction(fit, lF)
Crossover and mutation rate functions may be adaptive. The interface allows for dependencies of the rate on fitness and constants in the local configuration.
Constants for Adaptive Crossover and Mutation Rates
Constant | Default | Used in |
lF$CrossRate1() | ? | IACRate() |
lF$CrossRate2() | ? | IACRate() |
lF$MutationRate1() | IAMRate() | |
lF$MutationRate2() | IAMRate() | |
lF$CutoffFit() | ? | IACRate() |
lF$CBestFitness() | IACRate() | |
IAMRate() | ||
The xegaX-packages are a family of R-packages which implement eXtended Evolutionary and Genetic Algorithms (xega). The architecture has 3 layers, namely the user interface layer, the population layer, and the gene layer:
The user interface layer (package xega
)
provides a function call interface and configuration support
for several algorithms: genetic algorithms (sga),
permutation-based genetic algorithms (sgPerm),
derivation free algorithms as e.g. differential evolution (sgde),
grammar-based genetic programming (sgp) and grammatical evolution
(sge).
The population layer (package xegaPopulation
) contains
population related functionality as well as support for
population statistics dependent adaptive mechanisms and parallelization.
The gene layer is split in a representation independent and a representation dependent part:
The representation indendent part (package xegaSelectGene
)
is responsible for variants of selection operators, evaluation
strategies for genes, as well as profiling and timing capabilities.
The representation dependent part consists of the following packages:
xegaGaGene
for binary coded genetic algorithms.
xegaPermGene
for permutation-based genetic algorithms.
xegaDfGene
for derivation free algorithms as e.g.
differential evolution.
xegaGpGene
for grammar-based genetic algorithms.
xegaGeGene
for grammatical evolution algorithms.
The packages xegaDerivationTrees
and xegaBNF
support
the last two packages:
xegaBNF
essentially provides a grammar compiler and
xegaDerivationTrees
an abstract data type for derivation trees.
(c) 2023 Andreas Geyer-Schulz
MIT
https://github.com/ageyerschulz/xegaPopulation
From CRAN by install.packages('xegaPopulation')
Andreas Geyer-Schulz