_individual

Module Contents

Classes

Individual

Generic SQLAlchemy model for an individual.

Attributes

TGenotype

TGenotype
class Individual

Bases: experimentation.database.HasId, sqlalchemy.orm.MappedAsDataclass, Generic[TGenotype]

Inheritance diagram of experimentation.optimization.ea._individual.Individual

Generic SQLAlchemy model for an individual.

Inherit from this to create your own individual type.

This class is designed to be part of a Population. The metaclass argument population_table must contain the name of the population table.

The generic parameter TGenotype refers to the user-defined genotype type, which should have an id field that will be used as a foreign key reference. This parameter cannot be a forward reference.

For example:

class MyIndividual(Base, Individual[MyGenotype], population_table="my_population"):
    __tablename__ = "my_individual"
classmethod __init_subclass__(population_table: str, **kwargs: dict[str, Any]) None

Initialize a version of this class when it is subclassed.

Gets the actual type of TGenotype and value of population_table and stores them for later use.

Parameters:
  • population_table – Name of the population table.

  • kwargs – Remaining arguments passed to super.