pycellga.recombination package

Submodules

pycellga.recombination.arithmetic_crossover module

class pycellga.recombination.arithmetic_crossover.ArithmeticCrossover(parents: list, problem: AbstractProblem)[source]

Bases: RecombinationOperator

ArithmeticCrossover performs an arithmetic crossover operation on a pair of parent individuals to produce offspring individuals.

Parameters:
  • parents (list) – A list containing two parent individuals.

  • problem (AbstractProblem) – The problem instance that provides the fitness function.

__init__(parents: list, problem: AbstractProblem)[source]

Initialize the ArithmeticCrossover object.

Parameters:
  • parents (list) – A list containing two parent individuals.

  • problem (AbstractProblem) – The problem instance that provides the fitness function.

get_recombinations() List[Individual][source]

Perform the arithmetic crossover on the parent individuals to produce offspring.

Returns:

A list containing the offspring individuals.

Return type:

List[Individual]

pycellga.recombination.blxalpha_crossover module

class pycellga.recombination.blxalpha_crossover.BlxalphaCrossover(parents: list, problem: AbstractProblem)[source]

Bases: RecombinationOperator

BlxalphaCrossover performs BLX-alpha crossover on a pair of parent individuals to produce offspring individuals.

Parameters:
  • parents (list) – A list containing two parent individuals.

  • problem (AbstractProblem) – The problem instance that provides the fitness function.

__init__(parents: list, problem: AbstractProblem)[source]

Initialize the BlxalphaCrossover object.

Parameters:
  • parents (list) – A list containing two parent individuals.

  • problem (AbstractProblem) – The problem instance that provides the fitness function.

combine(p1: Individual, p2: Individual, locationsource: Individual) Individual[source]

Combine two parent individuals using BLX-alpha crossover to produce a single offspring.

Parameters:
  • p1 (Individual) – The first parent individual.

  • p2 (Individual) – The second parent individual.

  • locationsource (Individual) – The individual from which to copy positional information for the offspring.

Returns:

The resulting offspring individual.

Return type:

Individual

get_recombinations() List[Individual][source]

Perform the BLX-alpha crossover on the parent individuals to produce offspring.

Returns:

A list containing the offspring individuals.

Return type:

List[Individual]

pycellga.recombination.byte_one_point_crossover module

class pycellga.recombination.byte_one_point_crossover.ByteOnePointCrossover(parents: list, problem: AbstractProblem)[source]

Bases: RecombinationOperator

ByteOnePointCrossover operator defined in (Satman, 2013). ByteOnePointCrossover performs a one-point crossover at the byte level on a pair of parent individuals to produce offspring individuals.

Parameters:
  • parents (list) – A list containing two parent individuals.

  • problem (AbstractProblem) – The problem instance that provides the fitness function.

__init__(parents: list, problem: AbstractProblem)[source]

Initialize the ByteOnePointCrossover object.

Parameters:
  • parents (list) – A list containing two parent individuals.

  • problem (AbstractProblem) – The problem instance that provides the fitness function.

get_recombinations() List[Individual][source]

Perform the one-point crossover on the parent individuals at the byte level to produce offspring.

Returns:

A list containing the offspring individuals.

Return type:

List[Individual]

pycellga.recombination.byte_uniform_crossover module

class pycellga.recombination.byte_uniform_crossover.ByteUniformCrossover(parents: list, problem: AbstractProblem)[source]

Bases: RecombinationOperator

ByteUniformCrossover operator defined in (Satman, 2013). ByteUniformCrossover performs a uniform crossover at the byte level on a pair of parent individuals to produce offspring individuals.

Parameters:
  • parents (list) – A list containing two parent individuals.

  • problem (AbstractProblem) – The problem instance that provides the fitness function.

__init__(parents: list, problem: AbstractProblem)[source]

Initialize the ByteUniformCrossover object.

Parameters:
  • parents (list) – A list containing two parent individuals.

  • problem (AbstractProblem) – The problem instance that provides the fitness function.

combine(p1: Individual, p2: Individual, locationsource: Individual) Individual[source]

Combine two parent individuals using uniform crossover at the byte level to produce a single offspring.

Parameters:
  • p1 (Individual) – The first parent individual.

  • p2 (Individual) – The second parent individual.

  • locationsource (Individual) – The individual from which to copy positional information for the offspring.

Returns:

The resulting offspring individual.

Return type:

Individual

get_recombinations() List[Individual][source]

Perform the uniform crossover on the parent individuals to produce offspring.

Returns:

A list containing the offspring individuals.

Return type:

List[Individual]

pycellga.recombination.flat_crossover module

class pycellga.recombination.flat_crossover.FlatCrossover(parents: list, problem: AbstractProblem)[source]

Bases: RecombinationOperator

FlatCrossover performs a flat crossover on a pair of parent individuals to produce offspring individuals.

Parameters:
  • parents (list) – A list containing two parent individuals.

  • problem (AbstractProblem) – The problem instance that provides the fitness function.

__init__(parents: list, problem: AbstractProblem)[source]

Initialize the FlatCrossover object.

Parameters:
  • parents (list) – A list containing two parent individuals.

  • problem (AbstractProblem) – The problem instance that provides the fitness function.

combine(p1: Individual, p2: Individual, locationsource: Individual) Individual[source]

Combine two parent individuals using flat crossover to produce a single offspring.

Parameters:
  • p1 (Individual) – The first parent individual.

  • p2 (Individual) – The second parent individual.

  • locationsource (Individual) – The individual from which to copy positional information for the offspring.

Returns:

The resulting offspring individual.

Return type:

Individual

get_recombinations() List[Individual][source]

Perform the flat crossover on the parent individuals to produce offspring.

Returns:

A list containing the offspring individuals.

Return type:

List[Individual]

pycellga.recombination.linear_crossover module

class pycellga.recombination.linear_crossover.LinearCrossover(parents: list, problem: AbstractProblem)[source]

Bases: RecombinationOperator

LinearCrossover performs a linear crossover on a pair of parent individuals to produce offspring individuals.

Parameters:
  • parents (list) – A list containing two parent individuals.

  • problem (AbstractProblem) – The problem instance that provides the fitness function.

__init__(parents: list, problem: AbstractProblem)[source]

Initialize the LinearCrossover object.

Parameters:
  • parents (list) – A list containing two parent individuals.

  • problem (AbstractProblem) – The problem instance that provides the fitness function.

combine(p1: Individual, p2: Individual, locationsource: Individual) Individual[source]

Combine two parent individuals using linear crossover to produce a single offspring.

Parameters:
  • p1 (Individual) – The first parent individual.

  • p2 (Individual) – The second parent individual.

  • locationsource (Individual) – The individual from which to copy positional information for the offspring.

Returns:

The resulting offspring individual.

Return type:

Individual

get_recombinations() List[Individual][source]

Perform the linear crossover on the parent individuals to produce offspring.

Returns:

A list containing the offspring individuals.

Return type:

List[Individual]

pycellga.recombination.one_point_crossover module

class pycellga.recombination.one_point_crossover.OnePointCrossover(parents: list, problem: AbstractProblem)[source]

Bases: RecombinationOperator

OnePointCrossover performs a one-point crossover on a pair of parent individuals to produce offspring individuals.

Parameters:
  • parents (list) – A list containing two parent individuals.

  • problem (AbstractProblem) – The problem instance that provides the fitness function.

__init__(parents: list, problem: AbstractProblem)[source]

Initialize the OnePointCrossover object.

Parameters:
  • parents (list) – A list containing two parent individuals.

  • problem (AbstractProblem) – The problem instance that provides the fitness function.

get_recombinations() List[Individual][source]

Perform the one-point crossover on the parent individuals to produce offspring.

Returns:

A list containing the offspring individuals.

Return type:

List[Individual]

pycellga.recombination.pmx_crossover module

class pycellga.recombination.pmx_crossover.PMXCrossover(parents: list, problem: AbstractProblem)[source]

Bases: RecombinationOperator

PMXCrossover performs Partially Mapped Crossover (PMX) on a pair of parent individuals to produce offspring individuals.

Parameters:
  • parents (list) – A list containing two parent individuals.

  • problem (AbstractProblem) – The problem instance that provides the fitness function.

__init__(parents: list, problem: AbstractProblem)[source]

Initialize the PMXCrossover object.

Parameters:
  • parents (list) – A list containing two parent individuals.

  • problem (AbstractProblem) – The problem instance that provides the fitness function.

get_recombinations() List[Individual][source]

Perform the PMX crossover on the parent individuals to produce offspring.

Returns:

A list containing the offspring individuals.

Return type:

List[Individual]

pycellga.recombination.recombination_operator module

class pycellga.recombination.recombination_operator.RecombinationOperator[source]

Bases: object

get_recombinations() list[source]

pycellga.recombination.two_point_crossover module

class pycellga.recombination.two_point_crossover.TwoPointCrossover(parents: list, problem: AbstractProblem)[source]

Bases: RecombinationOperator

TwoPointCrossover performs a two-point crossover on a pair of parent individuals to produce offspring individuals.

Parameters:
  • parents (list) – A list containing two parent individuals.

  • problem (AbstractProblem) – The problem instance that provides the fitness function.

__init__(parents: list, problem: AbstractProblem)[source]

Initialize the TwoPointCrossover object.

Parameters:
  • parents (list) – A list containing two parent individuals.

  • problem (AbstractProblem) – The problem instance that provides the fitness function.

get_recombinations() List[Individual][source]

Perform the two-point crossover on the parent individuals to produce offspring.

Returns:

A list containing the offspring individuals.

Return type:

List[Individual]

pycellga.recombination.unfair_avarage_crossover module

class pycellga.recombination.unfair_avarage_crossover.UnfairAvarageCrossover(parents: list, problem: AbstractProblem)[source]

Bases: RecombinationOperator

UnfairAvarageCrossover performs an unfair average crossover on a pair of parent individuals to produce offspring individuals.

Parameters:
  • parents (list) – A list containing two parent individuals.

  • problem (AbstractProblem) – The problem instance that provides the fitness function.

__init__(parents: list, problem: AbstractProblem)[source]

Initialize the UnfairAvarageCrossover object.

Parameters:
  • parents (list) – A list containing two parent individuals.

  • problem (AbstractProblem) – The problem instance that provides the fitness function.

get_recombinations() List[Individual][source]

Perform the unfair average crossover on the parent individuals to produce offspring.

Returns:

A list containing the offspring individuals.

Return type:

List[Individual]

pycellga.recombination.uniform_crossover module

class pycellga.recombination.uniform_crossover.UniformCrossover(parents: list, problem: AbstractProblem)[source]

Bases: RecombinationOperator

UniformCrossover performs a uniform crossover on a pair of parent individuals to produce offspring individuals.

Parameters:
  • parents (list) – A list containing two parent individuals.

  • problem (AbstractProblem) – The problem instance that provides the fitness function.

__init__(parents: list, problem: AbstractProblem)[source]

Initialize the UniformCrossover object.

Parameters:
  • parents (list) – A list containing two parent individuals.

  • problem (AbstractProblem) – The problem instance that provides the fitness function.

combine(p1: Individual, p2: Individual, locationsource: Individual) Individual[source]

Combine two parent individuals using uniform crossover to produce a single offspring.

Parameters:
  • p1 (Individual) – The first parent individual.

  • p2 (Individual) – The second parent individual.

  • locationsource (Individual) – The individual from which to copy positional information for the offspring.

Returns:

The resulting offspring individual.

Return type:

Individual

get_recombinations() List[Individual][source]

Perform the uniform crossover on the parent individuals to produce offspring.

Returns:

A list containing the offspring individuals.

Return type:

List[Individual]

Module contents