An expression tree represents an executable or mathematical expression as a hierarchy. Operators occupy internal nodes; constants and inputs occupy terminal nodes. Node placement fixes the order in which the expression is evaluated. section 4.1.1 section 1.1.1
In genetic programming, a gene sequence can encode a reusable function or code routine. In gene expression programming, the sequence represents a mathematical expression tree whose evaluated output is compared with a target to assign error or fitness. section 4.1.1 section 1.1.1
Build a simple numerical tree by defining:
- A primitive set of allowed operators, such as addition, subtraction, multiplication, protected division, sine, cosine, and negation. section 4.1.1
- Terminals for inputs and generated constants; inputs may be scalars, arrays, or tensors. section 4.1.1
- Operator arity, because unary, binary, ternary, or n-ary operators determine how many child nodes each operator receives. section 4.1.1
- A compiled evaluation function and fitness calculation against target outputs. section 4.1.1
Symbolic regression
A tree rooted at multiplication can branch to addition and square-root operators, then to subtraction, inputs, and constants. Compiling the individual turns that structure into a callable function; squared error against generated targets measures its fitness. section 4.1.1
Expression trees need not be numerical equations. A GP tree can encode an agent routine: sequencing and conditional operators combine terminals such as move forward, turn left, and turn right. Executing the compiled routine in a grid environment yields fitness from food collected. section 12.4
For GEP, Geppy organizes sequences into genes and chromosomes, allowing complex components to be isolated and swapped during crossover. A linear target function can be evolved, compiled, simplified, and displayed as an equation tree. section 12.1
Trace how an individual gene sequence becomes an expression tree, evaluates as an equation, and receives fitness. section 4.1.1

