evolutionary_optimization.phenotype.implemented_phenotypes package

Submodules

evolutionary_optimization.phenotype.implemented_phenotypes.booth_phenotype module

class BoothPhenotype(genotype)[source]

Bases: AbstractPhenotype

__init__(genotype)[source]

Initialise InvertedParabolaPhenotype object.

Args

genotype: an AbstractGenotype that defines the phenotype.

crossover(parent_2)[source]

Perform crossover between two phenotypes.

Calls crossover method from the genotype attribute. Combines a portion of this object’s genotype with that of parent_2 to return 2 new phenotypes based on the combined genotypes. The new genotype length is the same as of the parents.

Parameters

parent_2 (BoothPhenotype) – a phenotype of the same class whose genotype will be mixed with

Return type

Tuple[BoothPhenotype, BoothPhenotype]

Returns

Two new phenotype instances based on the combined genotypes of the two parents.

evaluate_phenotype()[source]

In place method to calculate phenotype value using genotype.

This phenotype follows x^2 and as such is a single parameter optimisation problem. For a binary genotype the integer value is returned,for an integer list genotype only the first value is used. It updates the phenotype_value property in place once the calculation is done.

static evaluate_phenotype_using_arrays(x_values, y_values)[source]

Calculate multiple phenotype values from numpy arrays.

Return type

ndarray

classmethod from_phenotype(base_phenotype)[source]

Create new phenotype with the same attributes as the base phenotype, but a new random genotype.genotype.

Return type

BoothPhenotype

property genotype

AbstractGenotype that defines the phenotype.

mutate()[source]

In place modification of the genotype by randomly changing genes based on mutation probability.

Calls mutate method as implemented for the genotype attribute in order to perform mutation. Updates genotype attribute in place.

property phenotype_value

Stores value of the phenotype based on the genotype - calculated using evaluate_phenotype.

evolutionary_optimization.phenotype.implemented_phenotypes.inverted_parabola_phenotype module

class InvertedParabolaPhenotype(genotype)[source]

Bases: AbstractPhenotype

__init__(genotype)[source]

Initialise InvertedParabolaPhenotype object.

Args

genotype: an AbstractGenotype that defines the phenotype.

crossover(parent_2)[source]

Perform crossover between two phenotypes.

Calls crossover method from the genotype attribute. Combines a portion of this object’s genotype with that of parent_2 to return 2 new phenotypes based on the combined genotypes. The new genotype length is the same as of the parents.

Parameters

parent_2 (InvertedParabolaPhenotype) – a phenotype of the same class whose genotype will be mixed with

Return type

Tuple[InvertedParabolaPhenotype, InvertedParabolaPhenotype]

Returns

Two new phenotype instances based on the combined genotypes of the two parents.

evaluate_phenotype()[source]

In place method to calculate phenotype value using genotype.

This phenotype follows -x^2 and as such is a single parameter optimisation problem. For a binary genotype the integer value is returned,for an integer list genotype only the first value is used. It updates the phenotype_value property in place once the calculation is done.

static evaluate_phenotype_using_arrays(x_values, y_values)[source]

Calculate multiple phenotype values from numpy arrays.

Return type

ndarray

classmethod from_phenotype(base_phenotype)[source]

Create new phenotype with the same attributes as the base phenotype, but a new random genotype.genotype.

Return type

InvertedParabolaPhenotype

property genotype

AbstractGenotype that defines the phenotype.

mutate()[source]

In place modification of the genotype by randomly changing genes based on mutation probability.

Calls mutate method as implemented for the genotype attribute in order to perform mutation. Updates genotype attribute in place.

property phenotype_value

Stores value of the phenotype based on the genotype - calculated using evaluate_phenotype.

evolutionary_optimization.phenotype.implemented_phenotypes.parabola_phenotype module

class ParabolaPhenotype(genotype)[source]

Bases: AbstractPhenotype

__init__(genotype)[source]

Initialise InvertedParabolaPhenotype object.

Args

genotype: an AbstractGenotype that defines the phenotype.

crossover(parent_2)[source]

Perform crossover between two phenotypes.

Calls crossover method from the genotype attribute. Combines a portion of this object’s genotype with that of parent_2 to return 2 new phenotypes based on the combined genotypes. The new genotype length is the same as of the parents.

Parameters

parent_2 (ParabolaPhenotype) – a phenotype of the same class whose genotype will be mixed with

Return type

Tuple[ParabolaPhenotype, ParabolaPhenotype]

Returns

Two new phenotype instances based on the combined genotypes of the two parents.

evaluate_phenotype()[source]

In place method to calculate phenotype value using genotype.

This phenotype follows x^2 and as such is a single parameter optimisation problem. For a binary genotype the integer value is returned,for an integer list genotype only the first value is used. It updates the phenotype_value property in place once the calculation is done.

static evaluate_phenotype_using_arrays(x_values, y_values)[source]

Calculate multiple phenotype values from numpy arrays.

Return type

ndarray

classmethod from_phenotype(base_phenotype)[source]

Create new phenotype with the same attributes as the base phenotype, but a new random genotype.genotype.

Return type

ParabolaPhenotype

property genotype

AbstractGenotype that defines the phenotype.

mutate()[source]

In place modification of the genotype by randomly changing genes based on mutation probability.

Calls mutate method as implemented for the genotype attribute in order to perform mutation. Updates genotype attribute in place.

property phenotype_value

Stores value of the phenotype based on the genotype - calculated using evaluate_phenotype.

evolutionary_optimization.phenotype.implemented_phenotypes.saddle_point_phenotype module

class SaddlePointPhenotype(genotype)[source]

Bases: AbstractPhenotype

__init__(genotype)[source]

Initialise AbstractPhenotype object.

Args

genotype: an AbstractGenotype that defines the phenotype.

crossover(parent_2)[source]

Perform crossover between two phenotypes.

Calls crossover method from the genotype attribute. Combines a portion of this object’s genotype with that of parent_2 to return 2 new phenotypes based on the combined genotypes. The new genotype length is the same as of the parents.

Parameters

parent_2 (AbstractPhenotype) – a phenotype of the same class whose genotype will be mixed with

Return type

Tuple[AbstractPhenotype, AbstractPhenotype]

Returns

Two new phenotype instances based on the combined genotypes of the two parents.

evaluate_phenotype()[source]

Calculate phenotype value using genotype.

static evaluate_phenotype_using_arrays(x_values, y_values)[source]

Calculate multiple phenotype values from numpy arrays.

Return type

ndarray

classmethod from_phenotype(base_phenotype)[source]

Create new phenotype with the same attributes as the base phenotype.

property genotype

AbstractGenotype that defines the phenotype.

mutate()[source]

In place modification of the genotype by randomly changing genes based on mutation probability.

Calls mutate method as implemented for the genotype attribute in order to perform mutation. Updates genotype attribute in place.

property phenotype_value

Stores value of the phenotype based on the genotype - calculated using evaluate_phenotype.

Module contents