Skip to content

Crossover procedure

Marc Segond edited this page May 30, 2013 · 1 revision

This is a strongly-typed version of Koza-style "Subtree Crossover". Two individuals are selected. Then a random node is chosen in each tree such that the two nodes have the same return type. If by swapping subtrees at these nodes the two trees will not violate maximum depth constraints, then the trees perform the swap, otherwise, they repeat the hunt for random nodes.

The pipeline tries at most n times to a pair of random nodes BOTH with valid swap constraints. If it cannot find any such pairs after n times, it uses the pair of its last attempt. If either of the nodes in the pair is valid, that node gets substituted with the other node. Otherwise an individual invalid node isn't changed at all (it's "reproduced").

This method typically produces up to 2 new individuals (the two newly-swapped individuals) per call. If the system only needs a single individual, the pipeline will throw one of the new individuals away. The user can also have the pipeline always throw away the second new individual instead of adding it to the population.