Created by Scott Robert Ladd at Coyote Gulch Productions.
Associates organisms with the components of an evolutionary system. More...
#include <evocosm.h>
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 |
LandscapeType | - The type of landscape |
libevocosm::evocosm< OrganismType, LandscapeType >::evocosm | ( | listener & | a_listener, |
size_t | a_population_size, | ||
size_t | a_number_of_populations, | ||
size_t | a_number_of_unique_landscapes, | ||
size_t | a_number_of_common_landscapes, | ||
mutator< OrganismType > & | a_mutator, | ||
reproducer< OrganismType > & | a_reproducer, | ||
scaler< OrganismType > & | a_scaler, | ||
migrator< OrganismType > & | a_migrator, | ||
selector< OrganismType > & | a_selector, | ||
reporter< OrganismType, LandscapeType > & | a_reporter, | ||
organism_factory< OrganismType > & | a_organism_factory, | ||
landscape_factory< LandscapeType > & | a_landscape_factory, | ||
bool | a_minimizing = false |
||
) |
Creates a new evocosm. Think of an evocosm as a director, a tool for associating organisms with their environment. Note that these arguments are modifiable references, and that the referenced objects must continue to exist during the lifetime of the evocosm.
a_listener | - a listener for events |
a_population_size | - Initial population size |
a_number_of_populations | - Number of organisms in each population |
a_number_of_unique_landscapes | - Number of landscapes unique to each populations |
a_number_of_common_landscapes | - Number of landscapes common to all populations |
a_mutator | - A concrete implementation of mutator |
a_reproducer | - A concrete implementation of reproducer |
a_scaler | - A concrete implementation of scaler |
a_migrator | - A concrete implementation of migrator |
a_selector | - A concrete implementation of selector |
a_reporter | - A concrete implementation of reporter |
a_organism_factory | - A factory to create organisms |
a_landscape_factory | - A factory to create landscapes |
a_minimizing | - Set true when minimizing; i.e., best fitness < worst fitness |
References libevocosm::organism_factory< OrganismType >::append(), libevocosm::landscape_factory< LandscapeType >::generate(), libevocosm::evocosm< OrganismType, LandscapeType >::m_common_landscapes, libevocosm::evocosm< OrganismType, LandscapeType >::m_number_of_common_landscapes, libevocosm::evocosm< OrganismType, LandscapeType >::m_number_of_populations, libevocosm::evocosm< OrganismType, LandscapeType >::m_number_of_unique_landscapes, libevocosm::evocosm< OrganismType, LandscapeType >::m_population_size, libevocosm::evocosm< OrganismType, LandscapeType >::m_populations, and libevocosm::evocosm< OrganismType, LandscapeType >::m_unique_landscapes.
libevocosm::evocosm< OrganismType, LandscapeType >::evocosm | ( | const evocosm< OrganismType, LandscapeType > & | a_source | ) |
Creates a new evocosm identical to an existing one.
a_source | - The source object |
libevocosm::evocosm< OrganismType, LandscapeType >::~evocosm | ( | ) | [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.
evocosm< OrganismType, LandscapeType > & libevocosm::evocosm< OrganismType, LandscapeType >::operator= | ( | const evocosm< OrganismType, LandscapeType > & | a_source | ) |
Assigns an existing object the state of another.
a_source | - The source object |
References libevocosm::evocosm< OrganismType, LandscapeType >::m_common_landscapes, libevocosm::evocosm< OrganismType, LandscapeType >::m_iteration, libevocosm::evocosm< OrganismType, LandscapeType >::m_migrator, libevocosm::evocosm< OrganismType, LandscapeType >::m_mutator, libevocosm::evocosm< OrganismType, LandscapeType >::m_number_of_common_landscapes, libevocosm::evocosm< OrganismType, LandscapeType >::m_number_of_populations, libevocosm::evocosm< OrganismType, LandscapeType >::m_number_of_unique_landscapes, libevocosm::evocosm< OrganismType, LandscapeType >::m_population_size, libevocosm::evocosm< OrganismType, LandscapeType >::m_populations, libevocosm::evocosm< OrganismType, LandscapeType >::m_reproducer, libevocosm::evocosm< OrganismType, LandscapeType >::m_scaler, libevocosm::evocosm< OrganismType, LandscapeType >::m_selector, and libevocosm::evocosm< OrganismType, LandscapeType >::m_unique_landscapes.
vector<OrganismType, LandscapeType>& libevocosm::evocosm< OrganismType, LandscapeType >::population | ( | size_t | a_index = 0 | ) | [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.
a_index | Number of the population to return; defaults to 0 . |
References libevocosm::evocosm< OrganismType, LandscapeType >::m_populations.
bool libevocosm::evocosm< OrganismType, LandscapeType >::run_generation | ( | bool | a_finished, |
double & | a_fitness | ||
) | [virtual] |
A generation represents a cycle in the life of an evocosm; this function performs one sequence of fitness testing & scaling, void append(vector<gccga_organism> a_population, size_t a_size);
reporting, migration, 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.
void libevocosm::evocosm< OrganismType, LandscapeType >::terminate | ( | ) | [inline] |
Calling this function sets a flag that tells the evocosm to stop running as soon as possible.
References libevocosm::evocosm< OrganismType, LandscapeType >::m_running.
© 1996-2005 Scott Robert Ladd. All rights reserved.
HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.