liveBook · Manning

Terminal function

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

A terminal function is a genetic-programming function that supplies an executable leaf operation or observation without taking expression inputs.

A terminal function is an executable leaf in a genetic-programming routine. Unlike operators that combine expression inputs, it performs an action or supplies behavior without receiving expression arguments. In the ant simulator, terminal functions move or turn the agent, while the generated routine obtains its state from the simulator as it runs. section 12.4

Build a terminal-function set by registering concrete simulator methods:

  • Create a primitive set with zero expression inputs when the generated code reads its required state from the environment. section 12.4
  • Let higher-level operators invoke the terminal arguments; prog2 and prog3 sequence actions, while if_then_else selects between them. section 12.4

Ant movement terminals

The ant simulator exposes move_forward, turn_left, and turn_right as terminal functions. Each checks the move limit, updates the ant's state, and returns no output. A compiled GP routine repeatedly calls these terminals until the simulator reaches its move limit; fitness then counts collected food.

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

How deep it goes
Defines registration, invocation, and state mutation, but stops short of formal terminal semantics or implementation internals beyond the simulator methods.
Examples
Demonstrates move_forward, turn_left, and turn_right while evolving ant routines over grid environments.
What you can do after
Build it from scratch by registering simulator methods as terminals and composing them with sequencing and conditional operators.
How it connects
Connects genetic programming with primitive sets, expression trees, control operators, simulator state, and fitness evaluation.

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.