expressionCrossover: Random crossover (recombination) of functions and expressions

Description Usage Arguments Details Value

Description

Replace a random subtree of func1 (expr1) with a random subtree of func2 (expr2) and return the resulting function (expression), i.e. the modified func1 (expr1). crossoverexpr handles crossover of expressions instead of functions. crossoverexprFast is a fast (i.e. implemented in efficient C code) albeit less flexible variant of crossoverexpr. crossoverTyped and crossoverexprTyped only exchage replace subtress if the sTypes of their root nodes match. crossoverTwoPoint is a variant of crossover that swaps subtrees at uniform randomly selected points and returns both children. crossoverexprTwoPoint works analogously for expressions.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
crossover(func1, func2, crossoverprob = 0.1,
  breedingFitness = function(individual) TRUE, breedingTries = 50)

crossoverexpr(expr1, expr2, crossoverprob)

crossoverexprFast(expr1, expr2)

crossoverexprTwoPoint(expr1, expr2)

crossoverTyped(func1, func2, crossoverprob = 0.1,
  breedingFitness = function(individual) TRUE, breedingTries = 50)

crossoverexprTyped(expr1, expr2, crossoverprob)

Arguments

expr1

The first parent R expression.

func1

The first parent R function.

expr2

The second parent R expression.

func2

The second parent R function.

crossoverprob

The probability of crossover at each node of the first parent function (expression).

breedingFitness

A breeding function. See the documentation for geneticProgramming for details.

breedingTries

The number of breeding steps.

Details

All RGP recombination operators operating on functions have the S3 class c("recombinationOperator", "function").

Value

The child function (expression) or functions (expressions).


rgp documentation built on May 30, 2017, 12:45 a.m.