evol.helpers.mutators package

Submodules

evol.helpers.mutators.permutation module

evol.helpers.mutators.permutation.inversion(chromosome: Tuple[Any, ...], min_size: int = 2, max_size: int = None) → Tuple[Any, ...][source]

Mutate a chromosome using inversion.

Inverts a random partition of the chromosome.

Parameters:
  • chromosome – Original chromosome.
  • min_size – Minimum partition size. Defaults to 2.
  • max_size – Maximum partition size. Defaults to length - 1.
Returns:

Mutated chromosome.

evol.helpers.mutators.permutation.swap_elements(chromosome: Tuple[Any, ...]) → Tuple[Any, ...][source]

Randomly swap two elements of the chromosome.

Parameters:chromosome – Original chromosome.
Returns:Mutated chromosome.

Module contents