PrimitiveSet defines the building blocks from which genetic-programming candidates are assembled: available inputs, functions, terminals, and sometimes ephemeral constants. Its design constrains what an evolved expression or routine can represent, so it is part of the problem formulation rather than a neutral setup detail. section 12.2 section 12.4
For continuous-control equations, configure inputs to match the environment state, then add arithmetic operators and protected division. An ephemeral terminal can generate integer constants, letting evolution form parameterized equations as well as combine observations. section 12.2 section 12.3.3
A PrimitiveSet can be varied to direct the search:
- Change input names when environments expose different observation states, so compiled functions receive the required state values. section 12.2
- Add reusable evolved functions as higher-level operators, alongside a smaller arithmetic operator set and an environment indicator input. section 12.3.2
- Remove reusable operators and retain protected division and ephemeral constants to test a from-scratch generalized search. section 12.3.3
- Use zero inputs when generated routines obtain state themselves, then register conditional, sequencing, and movement primitives as executable code. section 12.4
A reusable-instinct configuration
A multi-environment controller uses inputs e, x, y, and velocity. It admits addition, subtraction, multiplication, and two previously evolved instinct functions; division and ephemeral constants are disabled because the base instincts already contain needed constants. Evaluation inserts the environment index and averages fitness across both environments. section 12.3.2
Listing 12.16 EDL_12_3_GEPPY_Instinctual.ipynb: Completing the primitive set
pset = gep.PrimitiveSet('Main', input_names=
['e', 'x', 'y', 'velocity']) #1
pset.add_function(operator.add, 2)
pset.add_function(operator.sub, 2)
pset.add_function(operator.mul, 2)
#pset.add_function(protected_div, 2) #2
pset.add_function(instinct1, 2) #3
pset.add_function(instinct2, 3) #4
#pset.add_ephemeral_terminal... #5
This configuration makes the search-space tradeoff concrete: it exposes environment and state inputs, keeps basic arithmetic, and promotes two evolved instincts to callable primitives. section 12.3.2
