6. Hall of Fame

The halloffame module provides a way to keep track of the best individuals that ever lived in the evolutionary process. It is used by the algorithms provided in the algorithms module.

class eap.halloffame.HallOfFame(maxsize)

The hall of fame contains the best individual that ever lived in the population during the evolution. It is sorted at all time so that the first element of the hall of fame is the individual that has the best first fitness value ever seen, according to the weights provided to the fitness at creation time.

The class HallOfFame provides an interface similar to a list (without being one completely). It is possible to retrieve its length, to iterate on it forward and backward and to get an item or a slice from it.

update(population)

Update the hall of fame with the population by replacing the worst individuals in the it by the best individuals present in population (if they are better). The size of the hall of fame is kept constant.

insert(item)

Insert a new individual in the hall of fame using the bisect_right() function. The inserted individual is inserted on the right side of an equal individual. Inserting a new individual in the hall of fame also preserve the hall of fame’s order. This method does not check for the size of the hall of fame, in a way that inserting a new individual in a full hall of fame will not remove the worst individual to maintain a constant size.

remove(index)

Remove the specified index from the hall of fame.

clear()

Clear the hall of fame.

class eap.halloffame.ParetoFront([similar])

The Pareto front hall of fame contains all the non-dominated individuals that ever lived in the population. That means that the Pareto front hall of fame can contain an infinity of different individuals.

The size of the front may become very large if it is used for example on a continuous function with a continuous domain. In order to limit the number of individuals, it is possible to specify a similarity function that will return True if the genotype of two individuals are similar. In that case only one of the two individuals will be added to the hall of fame. By default the similarity function is operator.__eq__().

Since, the Pareto front hall of fame inherits from the HallOfFame, it is sorted lexicographically at every moment.

update(population)

Update the Pareto front hall of fame with the population by adding the individuals from the population that are not dominated by the hall of fame. If any individual in the hall of fame is dominated it is removed.

Project Versions

Previous topic

5. Statistics

Next topic

7. Milestone

This Page