I've just started learning Grammatical Evolution and I'm reading the paper Grammatical Evolution by Michael O'Neill and Conor Ryan.

On page 3 (section IV-A), they write:

During the genotype-to-phenotype mapping process it is possible for individuals to run out of codons and in this case, we wrap the individual and reuse the codons.

I'm not an English native speaker and I don't understand the meaning of the word "wrap" here. What does it mean?

I understood that, if none of the symbols are terminals, we have to start from the beginning of the genotype again and replace the nonterminal symbols until we have only terminal symbols. But, if I'm correct, when do I have to stop? In the paper, they also talk about non-valid individuals.


1 Answer 1


In GE, the genotype is a linear sequence of codons. By "wrapping" it, you make it a circular sequence that never ends. It allows you to build a bigger tree, while having only a few codons. Still, it is possible to find such a combination of a genotype and a grammar that defines an infinitely deep expansion — such combinations are hardly suited for practical purposes.

I learned about GE recently. I implemented a GP/GE system to solve the Santa Fe Trail problem. I chose not to perform wrapping to make genotype-to-phenotype mapping more predictable (I always generate enough codons to complete a grammar expansion, and prune unused tails). I also went with a subtree crossover, and a subtree-local mutation, which effectively make the system more a classical GP (with a fancy genotype-to-phenotype mapping) than GE. So there are some options.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .