8. History

The history module provides a way to generate the genealogy tree of the famillies of individuals in an evolution.

Note

The genealogy tree might get very big if your population and/or the number of generation is large.

class eap.history.History

The History class helps to build a genealogy of all the individuals produced in the evolution. It contains two attributes, the genealogy_tree that is a dictionary of lists indexed by individual, the list contain the indice of the parents. The second attribute genealogy_history contains every individual indexed by their individual number as in the genealogy tree.

The produced genealogy tree is compatible with NetworkX, here is how to plot the genealogy tree

hist = History()

# Do some evolution and fill the history

import matplotlib.pyplot as plt
import networkx as nx

g = nx.DiGraph(hist.genealogy_tree)
nx.draw_springs(g)
plt.show()
populate(individuals)

Populate the history with the initial individuals. An attribute history_index is added to every individual, this index will help to track the parents and the childs through evolution. This index will be modified by the update() method when a child is produced. Modifying the internal genealogy_index of the history or the history_index of an individual may lead to unpredictable results and corruption of the history.

update(individual[, ...])

Update the history with the new individuals. The index present in their history_index attribute will be used to locate their parents and modified to a unique one to keep track of those new individuals.

decorator()

Function that returns an appropriate decorator to enhance the operators of the toolbox. The returned decorator assumes that the individuals are returned by the operator. First the decorator calls the underlying operation and then calls the update function with what has been returned by the operator as argument. Finally, it returns the individuals with their history parameters modified according to the update function.

Previous topic

7. Milestone

Next topic

9. Covariance Matrix Adaptation Evolution Strategy

This Page