Learn R Programming

rgp (version 0.4-1)

breed: Breeding of GP individuals

Description

Breeds GP individuals by repeated application of an individual factory function. individualFactory. The breedingFitness must be a function of domain logical (a single boolean value) or numeric (a single real number). In case of a boolean breeding function, candidate individuals are created via the individualFactory function and tested by the breedingFitness predicate until the breedingFitness predicate is TRUE or breedingTries tries were done, in which case the last individual created and tested is returned. In case of a numerical breeding function, breedingTries individuals are created and evaluated by the breedingFitness function. The individual with the minimal breeding fitness is returned.

Usage

breed(individualFactory, breedingFitness, breedingTries, warnOnFailure = TRUE, stopOnFailure = FALSE)

Arguments

individualFactory
A function of no parameters that returns a single GP individual.
breedingFitness
Either a function that takes a GP individual as its only parameter and returns a single logical value or a function that takes a GP individual as its only parameter and returns a single real value.
breedingTries
The number of breeding steps to perform. In case of a boolean breedingFitness function, the actual number of breeding steps performed may be lower then this number (see the details).
warnOnFailure
Whether to issue a warning when a boolean breedingFitness predicate was not fulfilled after breedingTries tries.
stopOnFailure
Whether to stop with an error message when a boolean breedingFitness predicate was not fulfilled after breedingTries tries.

Value

The GP individual that was bred.