110 likes | 269 Views
Evolving Recursive Algorithms. The SRF function Automatically defined recursions (ADRs) The recur operator Dealing with infinite and time-consuming recursions. The SRF Function. Defined by Koza. Used to evolve an algorithm that calculates the ith element of the Fibonacci sequence.
E N D
Evolving Recursive Algorithms • The SRF function • Automatically defined recursions (ADRs) • The recur operator • Dealing with infinite and time-consuming recursions
The SRF Function • Defined by Koza. • Used to evolve an algorithm that calculates the ith element of the Fibonacci sequence. • The SRF function takes two integer arguments. • An instance of the SRF function, e.g. SRF K D is interpreted as follows: • If the value of K is equal to the index of a fitness case that the SRF has already been evaluated on the function returns the stored value. If not the value of D is returned. • The value returned is stored as the output for the index specified in the fitness case the SRF instance is currently being evaluated on.
What will the output of the following individual be ? Fitness case: J= 0 , Output =1 Fitness case: J= 1 , Output =1 Raw fitness = 1
GP Parameters • Function to generate: Induce a recursive expression for the Fibonacci sequence. • Terminal set:T = {J, U} where U is the ephemeral constant in the range 0 to 3. • Function set:F = {+,-,*,SRF} • Number of generations:51 • Population size: 2000 • The ramped half-and-half method with an initial tree depth of six and a depth limit of seventeen on the size of trees created by the genetic operators. • Method of selection: Fitness proportionate selection.
GP Parameters • Raw fitness: The error function • Hits criterion:The number of fitness cases for which the tree has produced a value equal to the target value. • Fitness cases:The first twenty elements of the Fibonacci sequence. • Bound: 0 • Genetic operators: • Crossover - 90% • Reproduction - 10%
Evolved Solution • Koza performed two runs. A solution was found by generation 30 in one of the runs and by generation 22 in the other. • One of the solutions induced in prefix notation : ( + ( SRF ( - J 2 ) 0 ) ( SRF ( + ( + ( - J 2 ) 0 ) (SRF ( - J J ) 0 ) ) ( SRF ( SRF 3 1 ) 1 ) ) )
Automatically Defined Recursion (ADS) • An ADS consists of four branches: • A recursive condition branch (RCB) • A recursive body branch (RBB) • A recursive update branch (RUB) • A recursive ground branch (RGB) • Architecture-altering operators
Example N=2 ARG0 = 2 N=2 ARG0 = 1 N=2 ARG0 = 0 Output: 2
The recur Operator N=2 2 1 N=1 1