evokit.tools.lineage package

Module contents

class evokit.tools.lineage.VarySignature[source]

Bases: Protocol, Generic[D]

Signature of Variator.vary().

:meta private

__init__(*args, **kwargs)
evokit.tools.lineage.TrackParents(var: Variator[D], max_parents: int = 5) Variator[D][source]

Decorator that lets a variator track the lineage of an offspring.

In particular, each call to var.vary sets the Individual.parents of all offspring to its inputs.

Warning

To save cost, the Individual.parents is reset to None after an individual ever becomes the max_parents th parent of another individual.

If an individual is preserved for several generations, its Individual.parents may be expunged.

evokit.tools.lineage.register_parents(source_target_links: dict[str, tuple[str, set[str]]], ind: Individual, identifier: Callable[[Individual], str])[source]
evokit.tools.lineage.graph_lineage(individuals: ~typing.Sequence[~evokit.core.population.Individual], identifier: ~typing.Callable[[~evokit.core.population.Individual], str] = <function <lambda>>) Digraph[source]

Graph the lineage of an individual. This information can be accessed as Individual.parents.

Linage tracking is off by default. TrackParents() enables lineage tracking in a variator.

Parameters:
  • individuals – Individuals to plot.

  • identifier – A function to convert an individual to a unique identifier. The default id() is efficient but might not work with individual that have moved out of memory (for example, ones that have been Individual.load()ed)