GLSelectionistMixer Class Reference

#include <GLSelectionistMixer.h>

Inheritance diagram for GLSelectionistMixer:

GLBaseSelectionist

List of all members.

Classes

struct  TParameters

Public Member Functions

 GLSelectionistMixer (GLBaseRanker *ranker, const double &proportion_old=0.2)
 GLSelectionistMixer (GLBaseRanker *ranker, const GLSelectionistMixer::TParameters *parameters)
virtual ~GLSelectionistMixer ()
virtual int doSelection (const vector< GLBaseOrganism * > &current_population, const vector< GLBaseOrganism * > &candidates, size_t new_size, vector< GLBaseOrganism * > &to_live, vector< GLBaseOrganism * > &to_die, vector< const GLBaseOrganism * > &best_survived)
double getProportionOld () const
void setProportionOld (const double &new_proportion_old)


Detailed Description

Creates the new generation of organisms by keeping the best part of the current generation and mixing in the best part from the generation of children.

Definition at line 13 of file GLSelectionistMixer.h.


Constructor & Destructor Documentation

GLSelectionistMixer::GLSelectionistMixer ( GLBaseRanker ranker,
const double &  proportion_old = 0.2 
)

Constructor. Assigns the operator which will be used for ranking the organisms. Note, that the ranker will be destroyed when destructor is called.

Parameters:
ranker operator for arranging the organisms in accordance with their rank.
proportion_old number between 0 and 1 inclusive which determines how many organisms from the old generation will be passed to the new one. In any new generation of size S the S * proportion_old organism will come from the old generaion and S * (1 - proportion_old) organisms will be new.

Definition at line 17 of file GLSelectionistMixer.cpp.

GLSelectionistMixer::GLSelectionistMixer ( GLBaseRanker ranker,
const GLSelectionistMixer::TParameters parameters 
)

Constructor. Assigns the operator which will be used for ranking the organisms. Note, that the ranker will be destroyed when destructor is called.

Parameters:
ranker operator for arranging the organisms in accordance with their rank.
parameters parameters specific for this selectionist.

Definition at line 33 of file GLSelectionistMixer.cpp.

GLSelectionistMixer::~GLSelectionistMixer (  )  [virtual]

Destructor. Destroys everything, including ranker.

Definition at line 43 of file GLSelectionistMixer.cpp.


Member Function Documentation

int GLSelectionistMixer::doSelection ( const vector< GLBaseOrganism * > &  current_population,
const vector< GLBaseOrganism * > &  candidates,
size_t  new_size,
vector< GLBaseOrganism * > &  to_live,
vector< GLBaseOrganism * > &  to_die,
vector< const GLBaseOrganism * > &  best_survived 
) [virtual]

Choose which organism to leave and which one to die in the next generation. It is assumed, that all organisms passed as input parameters were evaluated already. The algorithm is as following: if the number of organism in the next generation should be S then keep S*getProportionOld() best organisms from the old generation and mix them with S * (1 - getProportionOld()) new organisms. If there is not enough organisms in either set then more organisms from the opposit set will be added. If number of organisms in both generation is too small then all of them will be part of the new generation.

Parameters:
current_population organisms from the this generation's population.
candidates newly created organisms (e.g. mutants and/or children). It is desirable, that both arrays have not common organisms.
new_size size of the next generation.
to_live output array of organisms to live (will be cleaned).
to_die output array of organisms to die in the next generation (will be cleaned).
best_survived best survived organism(s). May be single organism for single objective optimisation or the whole Pareto-front for multi-objective optimisation. The previous content of this array will be lost.
Returns:
number of NEW organisms (not present in current generation) in next generation.

Implements GLBaseSelectionist.

Definition at line 74 of file GLSelectionistMixer.cpp.

double GLSelectionistMixer::getProportionOld (  )  const [inline]

Returns the current settings for the proportion of old organisms in the new generation.

Returns:
current value for the proportion of old organisms in the new generation.

Definition at line 88 of file GLSelectionistMixer.h.

void GLSelectionistMixer::setProportionOld ( const double &  new_proportion_old  ) 

Sets the new value for the proportion of old organisms in the new generation.

Parameters:
new_proportion_old new value for the proportion of old organisms in the new generation. Must be between 0 and 1.0 inclusive.

Definition at line 141 of file GLSelectionistMixer.cpp.


The documentation for this class was generated from the following files:

Generated on Sat Jun 13 13:58:12 2009 for GenLib by  doxygen 1.5.9