Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

EAEnvironment Class Reference

The abstract base class for environments ("objective functions") where the fitness of Individuals is measured. More...

#include <gaenvrnmt.h>

Inheritance diagram for EAEnvironment:

BinaryTestEAEnv FloatTestEAEnv MultiMinEAEnv List of all members.

Public Methods

void setevals (int n)
int evals () const
int total_evals () const
void addnoise (double stddev)
double evaluate (const Individual &indiv)
void logDir (const String &dir)
void cycleReport (OStream &log, OStream &out)
virtual void addFeaturesTo (Genome &genome) const
virtual void init_cycle ()
virtual void check () const

Protected Methods

virtual double evaluateg (const Individual &ind)
virtual void cycle_report (OStream &log, OStream &out)

Protected Attributes

int mNEvals
int mTotEvals
int mCycles
double mNoise
IndividualmpBest
double mBestFitness
String mLogDir

Detailed Description

The abstract base class for environments ("objective functions") where the fitness of Individuals is measured.

The inheritors of this class are typically used as follows (assume that the parameter map has been defined and parameters to it inserted):

MyEnvironment myEnvir (paramMap, someOtherParameters);

SimplePopulation pop (envir, paramMap);

pop.evolve (100);

Note: the class is actually not abstract because the RTTI system doesn't allow that.

Definition at line 58 of file gaenvrnmt.h.


Member Function Documentation

virtual void addFeaturesTo Genome   genome const [inline, virtual]
 

Adds problem-specific features to a genome.

Reimplemented in BinaryTestEAEnv, FloatTestEAEnv, and MultiMinEAEnv.

Definition at line 106 of file gaenvrnmt.h.

Referenced by SimplePopulation::SimplePopulation().

void addnoise double    stddev [inline]
 

Orders to add gaussian noise to the evaluated fitness.

This is useful for testing the robustness of the EA for noisy evaluation.

Definition at line 88 of file gaenvrnmt.h.

References mNoise.

void check   [virtual]
 

Implementation for Object.

Definition at line 96 of file gaenvrnmt.cc.

References mCycles, mNEvals, mNoise, and mTotEvals.

Referenced by SimplePopulation::check().

virtual void cycle_report OStream &    log,
OStream &    out
[inline, protected, virtual]
 

Prints some statistics or something at the end of the evaluation cycle.

Reimplemented in BinaryTestEAEnv, FloatTestEAEnv, and MultiMinEAEnv.

Definition at line 130 of file gaenvrnmt.h.

Referenced by cycleReport().

void cycleReport OStream &    log,
OStream &    out
[inline]
 

Prints out a generation report to the given brief log stream and more verbose output stream.

Definition at line 100 of file gaenvrnmt.h.

References cycle_report(), and mCycles.

Referenced by EAStrategy::evolve().

int evals   const [inline]
 

Returns the number of evaluations to be done for each individual to determine it's fitness.

Definition at line 76 of file gaenvrnmt.h.

References mNEvals.

Referenced by Individual::evaluate().

double evaluate const Individual   ind
 

Evaluates fitness of an individual.

If artificial noise is defined for the environment, applies it to the fitness.

Keeps record of the best measured fitness and stores the individual having the fitness until a better one is found.

Returns:
Measured fitness.

Definition at line 69 of file gaenvrnmt.cc.

References evaluateg(), mBestFitness, mNoise, mpBest, and mTotEvals.

Referenced by Individual::evaluate().

virtual double evaluateg const Individual   ind [inline, protected, virtual]
 

Evaluates the fitness of the given individual in the environment.

MUST OVERLOAD!

Exceptions:
must_overload 

Reimplemented in BinaryTestEAEnv, FloatTestEAEnv, and MultiMinEAEnv.

Definition at line 126 of file gaenvrnmt.h.

Referenced by evaluate().

virtual void init_cycle   [inline, virtual]
 

Initializes a generation.

Not necessary in all models.

Reimplemented in BinaryTestEAEnv, FloatTestEAEnv, and MultiMinEAEnv.

Definition at line 110 of file gaenvrnmt.h.

References mBestFitness, and mpBest.

Referenced by EAStrategy::evolve().

void logDir const String &    dir [inline]
 

Sets evolution log directory for cycle reports and miscellaneous log files.

Definition at line 95 of file gaenvrnmt.h.

References mLogDir.

void setevals int    n [inline]
 

Sets the number of evaluations to be done for each individual to determine it's fitness.

This is useful only if the fitness measurement is noisy.

This variable should be set before starting the evolution, of course.

Definition at line 71 of file gaenvrnmt.h.

References mNEvals.

int total_evals   const [inline]
 

Returns the total number of evaluations performed in all generations so far.

This includes all multiple evaluations of all individuals.

Definition at line 82 of file gaenvrnmt.h.

References mTotEvals.


Member Data Documentation

double mBestFitness [protected]
 

(Subjective) fitness of the best individual.

"Subjective" means here that the artificial noise is included in this value.

Definition at line 158 of file gaenvrnmt.h.

Referenced by evaluate(), and init_cycle().

int mCycles [protected]
 

Basicly a generation counter.

It would be nicer if this was not stored here (redundacy, see).

Definition at line 143 of file gaenvrnmt.h.

Referenced by check(), and cycleReport().

String mLogDir [protected]
 

Directory for gathering evolution logs.

Definition at line 162 of file gaenvrnmt.h.

Referenced by logDir().

int mNEvals [protected]
 

Number of evaluations to be done for each individual, default=1.

Definition at line 134 of file gaenvrnmt.h.

Referenced by check(), evals(), and setevals().

double mNoise [protected]
 

Amount of artificial noise to be added to evaluated fitness.

This is useful for testing the effects of noise on evolution. Requires deterministic test functions to be useful.

Definition at line 149 of file gaenvrnmt.h.

Referenced by addnoise(), check(), and evaluate().

Individual* mpBest [protected]
 

The best individual in this cycle.

Definition at line 153 of file gaenvrnmt.h.

Referenced by evaluate(), and init_cycle().

int mTotEvals [protected]
 

Total number of evaluations done so far.

Definition at line 138 of file gaenvrnmt.h.

Referenced by check(), evaluate(), and total_evals().


The documentation for this class was generated from the following files:
Generated on Thu Feb 10 20:12:01 2005 for NeHeP by doxygen1.2.18