Created by Scott Robert Ladd at Coyote Gulch Productions.
Associates organisms with the components of an evolutionary system. More...
#include <evocosm.h>
Public Member Functions | |
| evocosm (vector< OrganismType > &a_population, landscape< OrganismType > &a_landscape, mutator< OrganismType > &a_mutator, reproducer< OrganismType > &a_reproducer, scaler< OrganismType > &a_scaler, selector< OrganismType > &a_selector, analyzer< OrganismType > &a_analyzer, listener< OrganismType > &a_listener) | |
| Creation constructor. More... | |
| evocosm (const evocosm< OrganismType > &a_source) | |
| Copy constructor. More... | |
| virtual | ~evocosm () |
| Virtual destructor. More... | |
| evocosm & | operator= (const evocosm< OrganismType > &a_source) |
| Assignment operator. More... | |
| virtual bool | run_generation () |
| Compute next generation. More... | |
| vector< OrganismType > & | get_population () |
| Directly view population. More... | |
| unsigned int | get_sleep_time () |
| Get the sleep time property value. More... | |
| void | set_sleep_time (unsigned int a_sleep_time) |
| Set the sleep time property value. More... | |
Protected Member Functions | |
| void | yield () |
| Yield. More... | |
Protected Attributes | |
| vector< OrganismType > & | m_population |
| The populations of organisms. | |
| landscape< OrganismType > & | m_landscape |
| Fitness landscapes common to all populations. | |
| mutator< OrganismType > & | m_mutator |
| A mutator to randomly influence genes. | |
| reproducer< OrganismType > & | m_reproducer |
| Creates new organisms. | |
| scaler< OrganismType > & | m_scaler |
| Scales the fitness of the evocosm. | |
| selector< OrganismType > & | m_selector |
| Selects organisms that survive from one generation to the next. | |
| analyzer< OrganismType > & | m_analyzer |
| Reports the a evocosm for analysis or display. | |
| listener< OrganismType > & | m_listener |
| A listener for evocosm progress. | |
| size_t | m_iteration |
| Count of iterations made. | |
| unsigned int | m_sleep_time |
| Number microseconds for process to sleep on yield. | |
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. | |
This is where it all comes together: An evocosm binds a evocosm of organisms to a set of objects that define how those organisms evolve.
| OrganismType | - The type of organism |
| libevocosm::evocosm< OrganismType >::evocosm | ( | vector< OrganismType > & | a_population, |
| landscape< OrganismType > & | a_landscape, | ||
| mutator< OrganismType > & | a_mutator, | ||
| reproducer< OrganismType > & | a_reproducer, | ||
| scaler< OrganismType > & | a_scaler, | ||
| selector< OrganismType > & | a_selector, | ||
| analyzer< OrganismType > & | a_analyzer, | ||
| listener< OrganismType > & | a_listener | ||
| ) |
Creates a new evocosm. Think of an evocosm as a director, a tool for associating organisms with their landscape. Note that these arguments are modifiable references, and that the referenced objects must continue to exist during the lifetime of the evocosm.
| a_population | Initial population of organisms |
| a_landscape | Initial set of landscaoes for testing organism fitness |
| a_mutator | - A concrete implementation of mutator |
| a_reproducer | - A concrete implementation of reproducer |
| a_scaler | - A concrete implementation of scaler |
| a_selector | - A concrete implementation of selector |
| a_analyzer | - A concrete implementation of analyzer |
| a_listener | - a listener for events |
| libevocosm::evocosm< OrganismType >::evocosm | ( | const evocosm< OrganismType > & | a_source | ) |
Creates a new evocosm identical to an existing one.
| a_source | - The source object |
|
virtual |
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.
|
inline |
Use with caution! This function provides direct read-write access to an evocosm's population. This is necessary when the organisms need special manipulation, such as when they can not be randomized by a default constructor.
|
inline |
Get the sleep time setting for this listerner. /return current value of sleep time (microseconds)
| evocosm< OrganismType > & libevocosm::evocosm< OrganismType >::operator= | ( | const evocosm< OrganismType > & | a_source | ) |
Assigns an existing object the state of another.
| a_source | - The source object |
|
virtual |
A generation represents a cycle in the life of an evocosm; this function performs one sequence of fitness testing & scaling, reporting, breeding, and mutation. This method can be replaced by in a derived class to define a different processing sequence; the default sequence defined here is good for most evolutionary algorithms I've created.
|
inline |
Set the sleep time property value. /param a_sleep_time new value of sleep time (microseconds)
|
inlineprotected |
Evocosm periodically invokes this function to allow other processes to run. In most cases, this will be some sort of platform-specific sleep function, such as usleep.
© 1996-2005 Scott Robert Ladd. All rights reserved.
HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.