bingo.variation package#

Submodules#

bingo.variation.add_random_individuals module#

variation that adds random individual(s)

This module wraps a variation in order to supply random individual(s) to the offspring after the variation is carried out.

class bingo.variation.add_random_individuals.AddRandomIndividuals(variation, chromosome_generator, num_rand_indvs=1)#

Bases: Variation

A variation object that takes in an implementation of variation that adds a random individual to the population before performing variation.

Parameters:
  • variation (variation) – variation object that performs the variation among individuals

  • chromosome_generator (Generator) – Generator for random individual

  • num_rand_indvs (int) – The number of random individuals to generate per call

bingo.variation.var_and module#

variation where crossover and mutation may co-occur

var_and.py is similar to the function of the same name in DEAP. It allows for definition of a variation by crossover and mutation probabilities. Offspring may be the result of both crossover :and: mutation, hence the name.

class bingo.variation.var_and.VarAnd(crossover, mutation, crossover_probability, mutation_probability)#

Bases: Variation

variation where crossover and mutation may co-occur

Parameters:
  • crossover (Crossover) – Crossover function class used in the variation

  • mutation (Mutation) – Mutation function class used in the variation

  • crossover_probability (float) – Probability that crossover will occur on an individual

  • mutation_probability (float) – Probability that mutation will occur on an individual

crossover_offspring#

list indicating whether the corresponding member of the last offspring was a result of crossover

Type:

array of bool

mutation_offspring#

list indicating whether the corresponding member of the last offspring was a result of mutation

Type:

array of bool

offspring_parents#

list indicating the parents (by index in the population) of the corresponding member of the last offspring

Type:

list of list of int

bingo.variation.var_or module#

variation where crossover, mutation, or replication may occur

var_or.py allows for definition of a variation by crossover, replication, and mutation probabilities. Offspring may be the result of either crossover, replication :or: mutation, hence the name. Only one may occur at a time.

class bingo.variation.var_or.VarOr(crossover, mutation, crossover_probability, mutation_probability)#

Bases: Variation

variation where either crossover, mutation, or replication may occur

Parameters:
  • crossover (Crossover) – Crossover function class used in variation

  • mutation (Mutation) – Mutation function class used in variation

  • crossover_probability (float) – Probability that crossover will occur on an individual

  • mutation_probability (float) – Probability that mutation will occur on an individual

crossover_offspring#

list indicating whether the corresponding member of the last offspring was a result of crossover

Type:

array of bool

mutation_offspring#

list indicating whether the corresponding member of the last offspring was a result of mutation

Type:

array of bool

offspring_parents#

list indicating the parents (by index in the population) of the corresponding member of the last offspring

Type:

list of list of int

bingo.variation.variation module#

The genetic operation of variation.

This module defines the basis of variation in bingo evolutionary analyses. Generally this consists of crossover, mutation and replication.

class bingo.variation.variation.Variation(crossover_types=None, mutation_types=None)#

Bases: object

A variator of individuals.

An abstract base class for the variation of genetic populations (list chromosomes) in bingo.

Parameters:
  • crossover_types (iterable of str, optional) – possible types of crossover (excluding None)

  • mutation_types (iterable of str, optional) – possible types of mutation (excluding None)

crossover_offspring_type#

numpy array indicating the crossover type that the corresponding offspring underwent (or None)

Type:

numpy array of str

crossover_types#

possible types of crossover (excluding None)

Type:

iterable of str

mutation_offspring_type#

numpy array indicating the mutation type that the corresponding offspring underwent (or None)

Type:

numpy array of str

mutation_types#

possible types of mutation (excluding None)

Type:

iterable of str

offspring_parents#

list indicating the parents (by index in the population) of the corresponding member of the last offspring

Type:

list of list of int

property crossover_types#

Types of crossover allowed in variation

property mutation_types#

Types of mutation allowed in variation

Module contents#