Evocosm - A C++ Framework for Evolutionary Computing

Main Index

Created by Scott Robert Ladd at Coyote Gulch Productions.


libevocosm::evocosm< OrganismType, LandscapeType > Class Template Reference

Associates organisms with the components of an evolutionary system. More...

#include <evocosm.h>

Inheritance diagram for libevocosm::evocosm< OrganismType, LandscapeType >:

libevocosm::globals

List of all members.

Public Member Functions

Protected Attributes


Detailed Description

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

Constructor & Destructor Documentation

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 
) [inline]

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>
libevocosm::evocosm< OrganismType, LandscapeType >::evocosm ( const evocosm< OrganismType, LandscapeType > &  a_source  )  [inline]

Creates a new evocosm identical to an existing one.

Parameters:
a_source - The source object

template<class OrganismType, class LandscapeType>
libevocosm::evocosm< OrganismType, LandscapeType >::~evocosm (  )  [inline, 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.


Member Function Documentation

template<class OrganismType, class LandscapeType>
evocosm< OrganismType, LandscapeType > & libevocosm::evocosm< OrganismType, LandscapeType >::operator= ( const evocosm< OrganismType, LandscapeType > &  a_source  )  [inline]

template<class OrganismType, class LandscapeType>
bool libevocosm::evocosm< OrganismType, LandscapeType >::run_generation ( bool  a_finished,
double &  a_fitness 
) [inline, 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.

References libevocosm::evocosm< OrganismType, LandscapeType >::m_common_landscapes, libevocosm::evocosm< OrganismType, LandscapeType >::m_iteration, libevocosm::evocosm< OrganismType, LandscapeType >::m_listener, libevocosm::evocosm< OrganismType, LandscapeType >::m_migrator, libevocosm::evocosm< OrganismType, LandscapeType >::m_minimizing, 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_reporter, libevocosm::evocosm< OrganismType, LandscapeType >::m_reproducer, libevocosm::evocosm< OrganismType, LandscapeType >::m_running, libevocosm::evocosm< OrganismType, LandscapeType >::m_scaler, libevocosm::evocosm< OrganismType, LandscapeType >::m_selector, libevocosm::evocosm< OrganismType, LandscapeType >::m_unique_landscapes, libevocosm::listener::ping_generation_begin(), libevocosm::listener::ping_generation_end(), libevocosm::listener::ping_population_begin(), libevocosm::listener::ping_population_end(), and libevocosm::listener::yield().

template<class OrganismType, class LandscapeType>
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.

Parameters:
a_index Number of the population to return; defaults to 0 .

References libevocosm::evocosm< OrganismType, LandscapeType >::m_populations.

template<class OrganismType, class LandscapeType>
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.


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.