Skip to content
Sujimichi edited this page Sep 12, 2010 · 15 revisions

An Individual represents one member of a population, and is and entity which contains a Genome. It’s functions allow it to interact with other members in the population, e.g

individual.fight(another_individual)

returns the winner
individual.mate(another_individual)

returns a new Individual with a Genome based on the “parent” Individuals

class Individual includes the module Fitness which gives the following:

individual.fitness

This assesses the Individuals’ Genome and returns a numerical score based on the DNA of the Genome and the fitness function which was applied. Individuals are selected (for contest) probabilistically (controlled by the Population) and one individual may never be selected or may be selected many times. In order to improve performance the fitness calculations an individual is only assessed once and the score is stored. Viral infection and radiation aside, generic material does not change in the life of an Individual and therefore nor does the genome based fitness score.

An Individual also has several functions which are not vital for evolution but can be used to provide extra information on the evolutionary path that was taken. OO Implementation makes it very easy to add further functionality without major re factors. For example i recently added a count of the number of times an Individual as won fights.


def fight opponent
	return self.victorious if (self.fitness > opponent.fitness)
	return opponent.victorious
end
def victorious
	@victories ||= 0
	@victories += 1
	self
end

In the study of evolution we often look at the direction that the entire population has taken by looking at average finesses per generation. I wanted to be able to follow the path that was taken by any given Individual. In order to achieve this i decided to make Individuals track whom their parents were, and this as facilitated the making of a Family Tree generator for Individuals of this GA.

Clone this wiki locally