Oh thanks for that :)<p>In my current scheme, malformed expressions just get a fitness of 0 (where fitness is between 0 and 1; 1 when the expression evaluates to the given target).<p>Varying lengths are achieved by randomly picking a length for each individual at the beginning. Thereafter, every generation gets varied length genomes automatically because of crossover. Not sure if this is the best approach, though.