liveBook · Manning

Genetic programming

As explained in Evolutionary Deep Learning: Genetic algorithms and neural networks

Genetic programming is an evolutionary method that develops executable programs or algorithmic code.

Genetic programming (GP) evolves executable code rather than only fixed parameter sequences. Candidate programs are assembled from functions, inputs, constants, and control logic; fitness selects routines that better solve a task. This makes GP useful when the desired result is an inspectable equation, decision routine, or program rather than a preset model structure. section 1.1.1 section 4.6

A GP individual can be represented as an expression tree. Operators form internal nodes, while constants and arguments form leaves; evaluating the resulting expression produces an output that can be compared with a target to assign fitness. GP shares evolutionary principles and many operators with genetic algorithms, but changes the chromosome structure and evaluation target. section 4.1 section 4.1.1

Figure 4.1 Example GP individual to expression tree to equation to fitness

Trace how a gene sequence becomes an expression tree, equation, and fitness value. section 4.1.1

A practical DEAP workflow is:

  • Define a primitive set of allowed operators, constants, and input arguments. section 4.1.1
  • Generate individuals and populations, then compile each evolved expression into a callable function. section 4.1.1
  • Evaluate outputs against targets, using an error value as fitness for symbolic regression. section 4.1.1
  • Visualize successful trees to inspect the derived equation or code routine. section 4.1.1 section 4.6

Symbolic regression and the genetic ant

For multivariable regression, GP can evolve an equation from four random inputs toward a target such as (x4 + x1) / x3 × x2. For the genetic ant, a primitive set combines conditionals and sequencing operators with movement terminals; compiled routines are rewarded by the food the ant consumes, then can be evolved across multiple environments. section 4.1.1 section 12.4

Primitive sets constrain what can evolve. An ant routine, for example, uses conditional and sequencing operators alongside actions such as move forward and turn; extending terminals, sensors, or environments creates new behaviors to search over. Testing across several environments pushes routines toward more general behavior. section 12.4 section 12.4.1

How Evolutionary Deep Learning: Genetic algorithms and neural networks covers it

How deep it goes
Explains expression-tree representation, DEAP setup, compilation, fitness evaluation, visualization, and configurable ant primitives without formal derivations.
Examples
Demonstrates a four-input symbolic-regression equation and a food-seeking genetic ant across multiple environments.
What it assumes
Builds on prior DEAP genetic-algorithm work while introducing GP-specific primitive sets, expression trees, and fitness evaluation.
What you can do after
Apply it via DEAP to define primitives, evolve and compile candidate programs, score fitness, and inspect resulting trees.
How it connects
Connects genetic programming with genetic algorithms, gene expression programming, expression trees, symbolic regression, and evolutionary computation.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Evolutionary Deep Learning: Genetic algorithms and neural networks. The section links point to the parts of the book it draws on.