alogos.systems.ge.neighborhood

Neighborhood functions to generate nearby genotypes for GE.

Functions

int_replacement(grammar, genotype, parameters=None)

Systematically change a chosen number of int codons.


Detailed object descriptions

alogos.systems.ge.neighborhood.int_replacement(grammar, genotype, parameters=None)[source]

Systematically change a chosen number of int codons.

Parameters:
  • grammar (Grammar)

  • genotype (Genotype)

  • parameters (dict or ParameterCollection, optional) – Following keyword-value pairs are considered by this function:

    • neighborhood_distance (int) : The distance from the original genotype to a new genotype in terms of replaced int codons.

    • neighborhood_max_size (int) : Maximum number of neighbor genotypes to generate.

    • neighborhood_only_terminals (bool) : If True, only replace codons that represent terminals.

    • max_expansions (bool) : Maximum number of nonterminal expansions used in a derivation.

    • max_wraps (bool) : Maximum number of wraps of the genotype that can be used in a derivation.

Returns:

neighbors (list of Genotype objects)