slim_gsgp.initializers

Initializers operator implementation.

slim_gsgp.initializers.initializers.full(init_pop_size, init_depth, FUNCTIONS, TERMINALS, CONSTANTS, p_c=0.3)[source]

Generates a list of individuals with random trees for a GM4OS population using the Full method.

Parameters:
  • init_pop_size (int) – The total number of individuals to be generated for the population.

  • init_depth (int) – The maximum depth of the trees.

  • FUNCTIONS (dict) – The dictionary of functions allowed in the trees.

  • TERMINALS (dict) – The dictionary of terminal symbols allowed in the trees.

  • CONSTANTS (dict) – The dictionary of constant values allowed in the trees.

  • p_c (float, optional) – The probability of a constant being chosen rather than a terminal in trees creation (default: 0.3).

Returns:

A list of Individual objects containing random trees and input sets based on the parameters provided.

Return type:

list

slim_gsgp.initializers.initializers.grow(init_pop_size, init_depth, FUNCTIONS, TERMINALS, CONSTANTS, p_c=0.3)[source]

Generates a list of individuals with random trees for a GM4OS population using the Grow method.

Parameters:
  • init_pop_size (int) – The total number of individuals to be generated for the population.

  • init_depth (int) – The maximum depth of the trees.

  • FUNCTIONS (dict) – The dictionary of functions allowed in the trees.

  • TERMINALS (dict) – The dictionary of terminal symbols allowed in the trees.

  • CONSTANTS (dict) – The dictionary of constant values allowed in the trees.

  • p_c (float, optional) – The probability of a constant being chosen rather than a terminal in trees creation (default: 0.3).

Returns:

A list of Individual objects containing random trees and input sets based on the parameters provided.

Return type:

list

slim_gsgp.initializers.initializers.rhh(init_pop_size, init_depth, FUNCTIONS, TERMINALS, CONSTANTS, p_c=0.3)[source]

Generates a list of individuals with random trees for a GM4OS population using the ramped-half-half method.

Parameters:
  • init_pop_size (int) – The total number of individuals to be generated for the population.

  • init_depth (int) – The maximum depth of the trees.

  • FUNCTIONS (dict) – The dictionary of functions allowed in the trees.

  • TERMINALS (dict) – The dictionary of terminal symbols allowed in the trees.

  • CONSTANTS (dict) – The dictionary of constant values allowed in the trees.

  • p_c (float, optional) – The probability of a constant being chosen rather than a terminal in trees creation (default: 0.3).

Returns:

A list of Individual objects containing random trees and input sets based on the parameters provided.

Return type:

list