geneticProgramming
for
untyped genetic programming or typedGeneticProgramming
for typed genetic
programming runs. The required argument fitnessFunction
must be supplied with
an objective function that assigns a numerical fitness value to an R function. Fitness
values are minimized, i.e. smaller values denote higher/better fitness. If a
multi-objective selectionFunction
is used, fitnessFunction
return a
numerical vector of fitness values. The result of the GP run is a GP result object
containing a GP population of R functions. summary.geneticProgrammingResult
can
be used to create summary views of a GP result object. During the run, restarts are
triggered by the restartCondition
. When a restart is triggered, the restartStrategy
is executed, which returns a new population to replace the current one as well as a list of
elite individuals. These are added to the runs elite list, where fitter individuals replace
individuals with lesser fittness. The runs elite list is always sorted by fitness in
ascending order. Only the first component of a multi-criterial fitness counts in this
sorting. After a GP run, the population is inserted into the elite list. The elite list
is returned as part of the GP result object.
geneticProgramming(fitnessFunction, stopCondition = makeTimeStopCondition(5), population = NULL, populationSize = 100, eliteSize = ceiling(0.1 * populationSize), elite = list(), functionSet = mathFunctionSet, inputVariables = inputVariableSet("x"), constantSet = numericConstantSet, crossoverFunction = crossover, mutationFunction = NULL, restartCondition = makeEmptyRestartCondition(), restartStrategy = makeLocalRestartStrategy(), searchHeuristic = makeAgeFitnessComplexityParetoGpSearchHeuristic(lambda = ceiling(0.5 * populationSize)), breedingFitness = function(individual) TRUE, breedingTries = 50, extinctionPrevention = FALSE, archive = FALSE, progressMonitor = NULL, verbose = TRUE)
typedGeneticProgramming(fitnessFunction, type, stopCondition = makeTimeStopCondition(5), population = NULL, populationSize = 100, eliteSize = ceiling(0.1 * populationSize), elite = list(), functionSet, inputVariables, constantSet, crossoverFunction = crossoverTyped, mutationFunction = NULL, restartCondition = makeEmptyRestartCondition(), restartStrategy = makeLocalRestartStrategy(populationType = type), searchHeuristic = makeAgeFitnessComplexityParetoGpSearchHeuristic(), breedingFitness = function(individual) TRUE, breedingTries = 50, extinctionPrevention = FALSE, archive = FALSE, progressMonitor = NULL, verbose = TRUE)
fitnessFunction
must be a single function that assigns a
numerical fitness value to a GP individual represented as a R function.
Smaller fitness values mean higher/better fitness. If a multi-objective
selection function is used, fitnessFunction
must return a numerical
vector of fitness values.typedGeneticProgramming
.makeStepsStopCondition
for details.populationSize
is created
through random growth.ceiling(0.1 * populationSize)
.searchHeuristics
for
available algorithms.TRUE
on the given individual, Op is
considered a success. If the breeding function returns FALSE
, Op
is retried a maximum of breedingTries
times. If this maximum number of
retries is exceeded, the result of the last try is considered as the result of
Op. In the case the breeding function returns a numeric value, the breeding
is repeated breedingTries
times and the individual with the lowest breeding
fitness is considered the result of Op.breedingFitness
function, the
maximum number of retries. In case of a numerical breedingFitness
function,
the number of breeding steps. Also see the documentation for the breedingFitness
parameter. Defaults to 50
.TRUE
, the initialization and
selection steps will try to prevent duplicate individuals
from occurring in the population. Defaults to FALSE
, as this
operation might be expensive with larger population sizes.TRUE
, all GP individuals evaluated are stored in an
archive list archiveList
that is returned as part of the result of this function.function(population, objectiveVectors, fitnessFunction, stepNumber, evaluationNumber,
bestFitness, timeElapsed, ...)
to be called with each evolution step. Seach heuristics
may pass additional information via the ...
parameter.population
, as well as metadata describing the run parameters.
summary.geneticProgrammingResult
, symbolicRegression