alogos.systems._shared.representation

Shared representations serving as base classes for all systems.

Classes

BaseGenotype

Base genotype for all systems to define a shared structure.

BaseIndividual

Base individual for all systems to define a shared structure.

BasePopulation

Base population for all systems to define a shared structure.


Detailed object descriptions

class alogos.systems._shared.representation.BaseGenotype[source]

Base genotype for all systems to define a shared structure.

copy(self)[source]

Create a deep copy of the genotype.

class alogos.systems._shared.representation.BaseIndividual(genotype=None, phenotype=None, fitness=float('nan'), details=None)[source]

Base individual for all systems to define a shared structure.

__init__(self, genotype=None, phenotype=None, fitness=float('nan'), details=None)[source]

Create an individual as simple container for genotype, phenotype and fitness.

copy(self)[source]

Create a deep copy of the individual.

less_than(self, other, objective)[source]

Determine if the fitness of this individual is less than that of another.

Parameters:
  • other (Individual)

  • objective (str) – Possible values:

    • "min" for a minimization problem

    • "max" for a maximization problem

    It determines how NaN values are treated in the comparsion.

Notes

There is a conceptual problem with NaN values, making the comparison depending on the type of optimization problem being tackled. In case of a minimization problem, any valid float number should be considered to be smaller than NaN, so that the individuals with NaN fitnesses loose in comparisons. In case of a maximization problem, it is the other way around. Therefore this explicit method with the argument objective is provided instead of the special method __lt__ that would allow individuals to be compared with the < operator but without any arguments.

References

greater_than(self, other, objective)[source]

Determine if the fitness of this individual is greater than that of another.

Parameters:
  • other (Individual)

  • objective (str) – Possible values:

    • "min" for a minimization problem

    • "max" for a maximization problem

    It determines how NaN values are treated in the comparsion.

Notes

There is a conceptual problem with NaN values, making the comparison depending on the type of optimization problem being tackled. In case of a minimization problem, any valid float number should be considered to be smaller than NaN, so that the individuals with NaN fitnesses loose in comparisons. In case of a maximization problem, it is the other way around. Therefore this explicit method with the argument objective is provided instead of the special method __gt__ that would allow individuals to be compared with the > operator but without any arguments.

References

class alogos.systems._shared.representation.BasePopulation(individuals)[source]

Base population for all systems to define a shared structure.

__init__(self, individuals)[source]

Create a population as container for multiple individuals.

copy(self)[source]

Create a deep copy of the population.

property num_unique_genotypes(self)

Get the number of unique genotypes in this population.

property num_unique_phenotypes(self)

Get the number of unique phenotypes in this population.

property num_unique_fitnesses(self)

Get the number of unique fitness values in this population.