Evocosm - A C++ Framework for Evolutionary Computing

Main Index

Created by Scott Robert Ladd at Coyote Gulch Productions.


Public Member Functions | Protected Attributes | List of all members
libevocosm::analyzer< OrganismType > Class Template Reference

Reports on a given population. More...

#include <analyzer.h>

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

Public Member Functions

 analyzer (listener< OrganismType > &a_listener, size_t max_iterations=0)
 Constructor. More...
 
 analyzer (const analyzer &a_source)
 Copy constructor.
 
analyzeroperator= (const analyzer &a_source)
 Assignment operator.
 
virtual ~analyzer ()
 Virtual destructor. More...
 
virtual bool analyze (const vector< OrganismType > &a_population, size_t a_iteration)
 Reports on a population. More...
 

Protected Attributes

listener< OrganismType > & m_listener
 The listener for events.
 
size_t m_max_iterations
 Maximum iterations; ignored if zero.
 

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.
 

Detailed Description

template<typename OrganismType>
class libevocosm::analyzer< OrganismType >

After fitness testing, the Evocosm invokes an analyzer. At a minimum, the analyzer determines if the population has reached a "final" or "finished" state.

Parameters
OrganismType- The type of organism

Constructor & Destructor Documentation

template<typename OrganismType>
libevocosm::analyzer< OrganismType >::analyzer ( listener< OrganismType > &  a_listener,
size_t  max_iterations = 0 
)
inline

Creates a new reporter object

Parameters
a_listener- a listener for events
template<typename OrganismType>
virtual libevocosm::analyzer< OrganismType >::~analyzer ( )
inlinevirtual

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<typename OrganismType>
virtual bool libevocosm::analyzer< OrganismType >::analyze ( const vector< OrganismType > &  a_population,
size_t  a_iteration 
)
inlinevirtual

The report method can do almost anything. In most case, it will display the "best" chromosome, draw a progress graph, or notify the user that another generation has passed. The return value tells an evocosm whether to continue evolving or not. The default implementation simply watches to see if a maximum number of iterations ahve been perfromed.

Parameters
a_population- A population of organisms
a_iteration- Iteration count for this report
Returns
true if evolution should continue; false if not

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.