Mutation operates by either random modification of a brick's parameters (size, position, orientation) or addition of a random brick.
The crossover operator involves two parent trees out of which random subtrees are selected. As in GP, the offspring generated has the first subtree removed and replaced by the second.
After mutation or crossover operators are applied, a new, possibly invalid specification tree is obtained. The result is expanded one node at a time and overlapping is checked. Whenever an overlap is found the tree is pruned at that site. With this procedure, a maximum spatially valid subtree is built from a crossover or mutation. Branches that could not be expanded are discarded.
The following mutation of 2.9, for example, is illegal because two bricks would share the same physical space (z = -1 after the second brick means that the third one goes below it, but the first brick is already there).
The tree will be pruned then at the site, yielding just three bricks
Once a valid tree has been obtained, the simulator is called to test for stability. Fitness is evaluated and the new individual is added to the population.