genetiK::RankingSelection Class Reference
[Common GenetiK framework]

Ranking Selection method. More...

#include <RankingSelection.h>

Inheritance diagram for genetiK::RankingSelection:

Inheritance graph
[legend]
Collaboration diagram for genetiK::RankingSelection:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 RankingSelection (void)
 default constructor
virtual ~RankingSelection (void)
 default destructor
void init (Population *population)
 initializes the Ranking Selection method with a specific Population
Individualselect ()
 selects an Individual from the current Population
IndividualgetBest ()
 retrieves the Individual having highest fitness in the Population
double phi (unsigned int rank)
 used to calculate the probability to select an Invididual

Detailed Description

Ranking Selection method.

This selection scheme is designed to select to individuals with a probability that is function of their specific rank in the population, sorted by (ascending) fitness.

More formally, for a generic individual i

\[ P_i \propto \phi(f_i) \]

This class uses by default an exponential function to calculate probability ($\phi(x) = e^x$). The probability itself is proportional to phi (it is proportional, but not equal, because the class itself encapsulates normalization). It is possible to override phi to define different selection policies.

See also:
Individual::fitness(), SelectionMethod, RouletteWheel and TournamentSelection


Member Function Documentation

Individual * genetiK::RankingSelection::getBest  )  [virtual]
 

retrieves the Individual having highest fitness in the Population

Returns:
the best Individual
See also:
Individual::fitness()

Implements genetiK::SelectionMethod.

void genetiK::RankingSelection::init Population population  )  [virtual]
 

initializes the Ranking Selection method with a specific Population

When initializing, the Cumulative Distribution Function (CDF) associated to the probability distribution defined by the previously mentioned function $\phi(f_i)$ is calculated.

Parameters:
population the Population to select the Individuals from

Reimplemented from genetiK::SelectionMethod.

double genetiK::RankingSelection::phi unsigned int  rank  ) 
 

used to calculate the probability to select an Invididual

It is possible to override this function to customize the schema used to calculate probability to select an Individual. This implementation, in particular, defines $\phi(x)$ as $e^x$.

Parameters:
rank the position of the Individual in the sorted Population
Returns:
the value function $\phi$ described above
See also:
Individual::fitness()

Individual * genetiK::RankingSelection::select  )  [virtual]
 

selects an Individual from the current Population

An Individual i will be selected with probability

\[ P_i = \frac{\phi(f_i)}{max(f_j)} \]

Returns:
the selected Individual
Exceptions:
IllegalStateException if the Population has not been previously initialized with init(Population* population)
See also:
init(Population* population), IllegalStateException

Implements genetiK::SelectionMethod.


The documentation for this class was generated from the following files:
Generated on Thu Feb 23 12:22:02 2006 for GenetiK by  doxygen 1.4.6