Evocosm - A C++ Framework for Evolutionary Computing

Main Index

Created by Scott Robert Ladd at Coyote Gulch Productions.


Public Member Functions | List of all members
libevocosm::selector< OrganismType > Class Template Referenceabstract

Selects organisms that survive. More...

#include <selector.h>

Inheritance diagram for libevocosm::selector< OrganismType >:
libevocosm::globals libevocosm::all_selector< OrganismType > libevocosm::elitism_selector< OrganismType > libevocosm::null_selector< OrganismType >

Public Member Functions

virtual ~selector ()
 Virtual destructor. More...
 
virtual vector< OrganismType > select_survivors (vector< OrganismType > &a_population)=0
 Select individuals that survive. More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from libevocosm::globals
static size_t rand_index (size_t n)
 Static function to allow use of g_random function pointer in random_shuffle.
 
static void set_seed (uint32_t a_seed)
 Set the seed for the random number generator.
 
static uint32_t get_seed ()
 Set the seed for the random number generator.
 
static std::string version ()
 Get version number.
 
- Static Protected Attributes inherited from libevocosm::globals
static prng g_random
 A shared random number generator.
 
static std::string g_version
 Version number.
 

Detailed Description

template<class OrganismType>
class libevocosm::selector< OrganismType >

A selector decides which organisms survive from one generation to the next. Some evolutionary algorithms will not use a selector; others will. In general, it is effective to keep the "best" organisms from one generation ot the next, so that good genes do not become lost at random.

Of course, "real" nature isn't so kind; just because you're the biggest stag in the forest doesn't mean you won't get shot! In fact, that may say something about the "best" – maybe the "best" stag is the one that is too ugly for anyone to hunt?

Parameters
OrganismType- The type of organism being selected

Constructor & Destructor Documentation

template<class OrganismType>
virtual libevocosm::selector< OrganismType >::~selector ( )
inlinevirtual

A virtual destructor. By default, it does nothing; this is a placeholder that identifies this class as a potential base, ensuring that objects of a derived class will have their destructors called if they are destroyed through a base-class pointer.

Member Function Documentation

template<class OrganismType>
virtual vector<OrganismType> libevocosm::selector< OrganismType >::select_survivors ( vector< OrganismType > &  a_population)
pure virtual

Produces a vector containing copies of the organisms selected for survival.

Parameters
a_population- A population of organisms
Returns
A population of copied survivors

Implemented in libevocosm::elitism_selector< OrganismType >, libevocosm::elitism_selector< libevocosm::function_solution >, libevocosm::all_selector< OrganismType >, and libevocosm::null_selector< OrganismType >.


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

© 1996-2005 Scott Robert Ladd. All rights reserved.
HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.