Created by Scott Robert Ladd at Coyote Gulch Productions.
Selects organisms that survive. More...
#include <selector.h>
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 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 prng | g_random |
A shared random number generator. | |
static std::string | g_version |
Version number. | |
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?
OrganismType | - The type of organism being selected |
|
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.
|
pure virtual |
Produces a vector containing copies of the organisms selected for survival.
a_population | - A population of organisms |
Implemented in libevocosm::elitism_selector< OrganismType >, libevocosm::elitism_selector< libevocosm::function_solution >, libevocosm::all_selector< OrganismType >, and libevocosm::null_selector< OrganismType >.
© 1996-2005 Scott Robert Ladd. All rights reserved.
HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.