|
| | 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) |
| | Creation constructor. More...
|
| |
| | evocosm (const evocosm< OrganismType, LandscapeType > &a_source) |
| | Copy constructor. More...
|
| |
| virtual | ~evocosm () |
| | Virtual destructor. More...
|
| |
| evocosm & | operator= (const evocosm< OrganismType, LandscapeType > &a_source) |
| | Assignment operator. More...
|
| |
| virtual bool | run_generation (bool a_finished, double &a_fitness) |
| | Compute next generation. More...
|
| |
| vector< OrganismType, LandscapeType > & | population (size_t a_index=0) |
| | Directly view population. More...
|
| |
| void | terminate () |
| | Terminate this run. More...
|
| |
template<class OrganismType, class LandscapeType>
class libevocosm::evocosm< OrganismType, LandscapeType >
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.
- Parameters
-
| OrganismType | - The type of organism |
| LandscapeType | - The type of landscape |
template<class OrganismType , class LandscapeType >
| 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.
- Parameters
-
| 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::enforce_lower_limit(), 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.
template<class OrganismType , class LandscapeType >
| 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.
- Returns
- Returns false when the generation has reached a specific goal.