P is for Practical  
PerlMonks 
comment on 
( #3333=superdoc: print w/replies, xml )  Need Help?? 
For a tree represented as a recursive hash, the crossover and mutation operators are fairly simple.
It looks like you have only binomial operators, so a binary tree. To arrive at a random node, start at the root, $tree, and pick a random key, "left" or right". Then ,e.g., $tree>{left} becomes the new root and pick another random key, etc. Continue walking the hash until you get to a terminal, which you can recognize as a nonreference. Alter that terminal to get a onepoint mutation. For a crossover, each node on the tree is a ref, so you can just exchange references: For Boolean expression chromosomes, you will want to make sure that mutations and crossovers generate a syntatctically valid expression (I haven't checked your code for this). That is the general idea. The implementation is left as an exercise :) Mark In reply to Re: GP problem with tree structure using hash
by kvale

