Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Experiment Design Guide

A typical work flow consists of creating an experiment, which uses one or more genomes to maximize a fitness criterion. Teem will evaluate the genomes several times, and, hopefully, the performance will increase with time.

Generational Evolution

The standard type of evolution is by generation (Teem::GenerationalEvolutionRun). It works by creating a generation of individuals, evaluating them, reproducing the best, and creating another generation. The first generation is composed of random individuals.

A generational evolution experiment has to inherit from Teem::Experiment because it is an experiment and from Teem::Evaluable because it can evaluate genomes and return a fitness. You can thus create one by copying and renaming the NullExperiment.h/.cpp files:

NullExperiment.h:

#ifndef __NULL_EXPERIMENT_H
#define __NULL_EXPERIMENT_H

#include "../ga/Evolution.h"
#include "../ga/GenerationalEvolution.h"
#include "Experiment.h"

namespace Teem
{
    class NullExperiment: public Experiment, public Evaluable
    {
    public:
        virtual void setupDecoders(GenotypeDecoders &decoders);
        virtual void compute(GenotypeDecoders &decoders, GenerationalPopulation &individuals, unsigned gen, unsigned ind, EvaluationMode mode);
    };
}

#endif

NullExperiment.cpp:

#include "NullExperiment.h"

namespace Teem
{
    // make sure the experiment will be available in experiment list
    REGISTER_EXPERIMENT(NullExperiment);
    
    void NullExperiment::setupDecoders(GenotypeDecoders &decoders)
    {
        // Here come the code to setp the GenotypeDecoders, like setting the number of I/O, etc...
    }
    
    void NullExperiment::compute(GenotypeDecoders &decoders, GenerationalPopulation &individuals, unsigned gen, unsigned ind, EvaluationMode mode)
    {
        // Here come the code of evaluating the individuals, whose genomes are decoded using decoders.
        
        // Fitness has to be returned in individuals
        
        for (size_t i=0; i<individuals.size(); i++)
        {
            individuals[i].fitness = 0;
        }
    }
}

You then have to change the class name and the content of the macro REGISTER_EXPERIMENT(your_experiment_class_name) so that your experiment will appear in the list of available experiments (the list can be displayed by teem -l).

Steady-State Evolution

Teem also supports another type of evolution, called steady-state (Teem::SteadyStateEvolutionRun). In this mode, there is no strictly defined generation, but rather a pool of individuals, that do something and can reproduce or die. At the beginning, the poll is initialised with a certain number of random individuals. The fitness criterion usually calculated at the end of trials is replaced by a continuous variable (often an abstract "energy").
Generated on Mon Oct 24 17:38:26 2005 for Teem by  doxygen 1.4.2