alogos.systems._shared.crossover

Shared crossover functions for several systems.

Functions

two_point_length_preserving(grammar, gt1, gt2, parameters, representation)

Generate new genotypes by exchanging sequence parts.


Detailed object descriptions

alogos.systems._shared.crossover.two_point_length_preserving(grammar, gt1, gt2, parameters, representation)[source]

Generate new genotypes by exchanging sequence parts.

Select two random, but equally long subsequences in the two genotypes and exchange them.

Parameters:
  • grammar (Grammar)

  • genotype1 (Genotype) – Genotype of the first parent.

  • genotype2 (Genotype) – Genotype of the second parent.

  • parameters (dict or ParameterCollection) – No keyword-value pairs are considered by this function. This argument is only available to have a consistent interface.

  • representation (module) – Representation module of the system that calls this generic function. This module contains the specific Genotype subclass of the system, which is used here to create the child genotypes.

Returns:

  • genotype1 (Genotype) – Genotype of the first child.

  • genotype2 (Genotype) – Genotype of the second child.