Main Page   Class Hierarchy   Alphabetical List   Compound List   Compound Members  

prapi::ga::RankSelector< T > Class Template Reference

#include <GeneticEngine.h>

Inheritance diagram for prapi::ga::RankSelector< T >:

prapi::ga::SurvivorSelector< T > List of all members.

Detailed Description

template<class T = double>
class prapi::ga::RankSelector< T >

RankSelector implements tye SurvivorSelection intereface by a rank order selection scheme.


Public Methods

 RankSelector (double selectionProbability=0.25, double rate=0.2)
 Create a new RankSelector with the given survivor selection probability and survival rate.

virtual void selectSurvivors (const util::List< Individual< T > > &from, util::List< Individual< T > > &to)
 Select some fit individuals that survive to the next generation.


Public Attributes

double survivorSelectionProbability
 A value in the range [0,1] that tells how probable it is for the fittest individual to be first selected as a survivor.

double survivalRate
 A value in the range [0,1] that indicates the fraction of a population that survives to the next generation.


Constructor & Destructor Documentation

template<class T = double>
prapi::ga::RankSelector< T >::RankSelector double    selectionProbability = 0.25,
double    rate = 0.2
[inline]
 

Create a new RankSelector with the given survivor selection probability and survival rate.

If you are using a CrossingOverBreeder or similar, you need to make sure that the selection rates of these objects sum up to unity. Otherwise your population will either shrink or grow.


Member Function Documentation

template<class T>
void prapi::ga::RankSelector< T >::selectSurvivors const util::List< Individual< T > > &    from,
util::List< Individual< T > > &    to
[virtual]
 

Select some fit individuals that survive to the next generation.

This implementation selects survivalRate*from.getLength() individuals from from using a rank selection method. That is, the most fit individual is selected to the next generation with the probability selectionProbability in the first round. If it is not selected, the second most fit individual is selected with the same probability. This continues until an individual is selected. The same procedure is repeated for the remaining individuals until the needed number of individuals is selected.

Parameters:
from  the list from which individuals are to be selected. createNextGeneration always sorts from prior to calling this method (ascending fitness order).
to  the list that stores the selected individuals

Implements prapi::ga::SurvivorSelector< T >.


The documentation for this class was generated from the following file:
Documentation generated on 11.09.2003 with Doxygen.
The documentation is copyrighted material.
Copyright © Topi Mäenpää 2003. All rights reserved.