alogos.systems.whge.neighborhood

Neighborhood functions to generate nearby genotypes for WHGE.

Functions

bit_flip(grammar, genotype, parameters=None)

Generate nearby genotypes by flipping n bits.


Detailed object descriptions

alogos.systems.whge.neighborhood.bit_flip(grammar, genotype, parameters=None)[source]

Generate nearby genotypes by flipping n bits.

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.

Returns:

neighbors (list of Genotype objects)