Evocosm - A C++ Framework for Evolutionary Computing

Main Index

Created by Scott Robert Ladd at Coyote Gulch Productions.


Public Member Functions | Protected Member Functions | Protected Attributes
libevocosm::evocosm< OrganismType > Class Template Reference

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

#include <evocosm.h>

Inheritance diagram for libevocosm::evocosm< OrganismType >:
libevocosm::globals

List of all members.

Public Member Functions

Protected Member Functions

Protected Attributes


Detailed Description

template<class OrganismType>
class libevocosm::evocosm< OrganismType >

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

Constructor & Destructor Documentation

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

Parameters:
a_populationInitial population of organisms
a_landscapeInitial 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
template<class OrganismType>
libevocosm::evocosm< OrganismType >::evocosm ( const evocosm< OrganismType > &  a_source)

Creates a new evocosm identical to an existing one.

Parameters:
a_source- The source object
template<class OrganismType >
libevocosm::evocosm< OrganismType >::~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.


Member Function Documentation

template<class OrganismType>
vector<OrganismType>& libevocosm::evocosm< OrganismType >::get_population ( ) [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.

template<class OrganismType>
unsigned int libevocosm::evocosm< OrganismType >::get_sleep_time ( ) [inline]

Get the sleep time setting for this listerner. /return current value of sleep time (microseconds)

template<class OrganismType>
evocosm< OrganismType > & libevocosm::evocosm< OrganismType >::operator= ( const evocosm< OrganismType > &  a_source)
template<class OrganismType >
bool libevocosm::evocosm< OrganismType >::run_generation ( ) [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.

Returns:
Returns true when the generation has reached a specific goal.
template<class OrganismType>
void libevocosm::evocosm< OrganismType >::set_sleep_time ( unsigned int  a_sleep_time) [inline]

Set the sleep time property value. /param a_sleep_time new value of sleep time (microseconds)

template<class OrganismType>
void libevocosm::evocosm< OrganismType >::yield ( ) [inline, protected]

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.


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.