GLBaseGeneticAlgorithm Class Reference

#include <GLBaseGeneticAlgorithm.h>

Inheritance diagram for GLBaseGeneticAlgorithm:

GLGeneticAlgorithmStandard

List of all members.

Public Member Functions

 GLBaseGeneticAlgorithm (const GLParametersGeneticAlgorithm &parameters, GLFactory *factory)
virtual ~GLBaseGeneticAlgorithm ()
GLBaseBreedergetBreeder ()
const GLBaseBreedergetBreeder () const
GLBaseCrossovergetCrossover ()
const GLBaseCrossovergetCrossover () const
GLBaseEvaluatorgetEvaluator () const
GLBaseMutatorgetMutator ()
const GLBaseMutatorgetMutator () const
const
GLParametersGeneticAlgorithm
getParameters () const
GLBaseRankergetRanker ()
const GLBaseRankergetRanker () const
GLBaseSelectionistgetSelectionist ()
const GLBaseSelectionistgetSelectionist () const
virtual const GLBaseGaStatusgetStatus () const =0
GLBaseVariatorgetVariator ()
const GLBaseVariatorgetVariator () const
virtual void reset ()
virtual const GLBaseGaStatusrunGA (GLBaseOrganismInitialiser *initialiser, GLBaseEvaluator *evaluator, const TListOfStoppers &stoppers, bool bool_operator=GLConstants::OR_OPERATOR)=0

Protected Member Functions

virtual bool toFinish (const TListOfStoppers &stoppers, bool bool_operator)

Protected Attributes

GLBaseEvaluatorm_evaluator


Detailed Description

Prototype of the genetic algorithm class.

Definition at line 23 of file GLBaseGeneticAlgorithm.h.


Constructor & Destructor Documentation

GLBaseGeneticAlgorithm::GLBaseGeneticAlgorithm ( const GLParametersGeneticAlgorithm parameters,
GLFactory factory 
)

Constructor. Creates the genetic algorithm.

Parameters:
parameters genetic algorithm's parameters. They are copied within the GA so any further changes to the exemplar passed to constructor will not affect the GA behaviour.
factory factory to create GA elements (mutator, crossover etc.).
Constructor. Creates the Genetic algorithm.
Parameters:
parameters genetic algorithm's parameters.
factory factory to create GA elements (mutator, crossover etc.).

Definition at line 26 of file GLBaseGeneticAlgorithm.cpp.

GLBaseGeneticAlgorithm::~GLBaseGeneticAlgorithm (  )  [virtual]

Destructor. Destroys everything owned by the GA.

Definition at line 36 of file GLBaseGeneticAlgorithm.cpp.


Member Function Documentation

const GLBaseBreeder* GLBaseGeneticAlgorithm::getBreeder (  )  const [inline]

Returns the current breeder used by GA.

Returns:
breeder currently in use by GA.

Definition at line 52 of file GLBaseGeneticAlgorithm.h.

GLBaseBreeder* GLBaseGeneticAlgorithm::getBreeder (  )  [inline]

Returns the current breeder used by GA.

Returns:
breeder currently in use by GA.

Definition at line 45 of file GLBaseGeneticAlgorithm.h.

const GLBaseCrossover* GLBaseGeneticAlgorithm::getCrossover (  )  const [inline]

Returns the GA's crossover.

Returns:
crossover used by this GA.

Definition at line 66 of file GLBaseGeneticAlgorithm.h.

GLBaseCrossover* GLBaseGeneticAlgorithm::getCrossover (  )  [inline]

Returns the GA's crossover.

Returns:
crossover used by this GA.

Definition at line 59 of file GLBaseGeneticAlgorithm.h.

GLBaseEvaluator* GLBaseGeneticAlgorithm::getEvaluator (  )  const [inline]

Returns the evaluator currently in use by the GA.

Definition at line 72 of file GLBaseGeneticAlgorithm.h.

const GLBaseMutator* GLBaseGeneticAlgorithm::getMutator (  )  const [inline]

Returns the mutator currently in use by GA.

Returns:
mutator which is currently used by this GA.

Definition at line 86 of file GLBaseGeneticAlgorithm.h.

GLBaseMutator* GLBaseGeneticAlgorithm::getMutator (  )  [inline]

Returns the mutator currently in use by GA.

Returns:
mutator which is currently used by this GA.

Definition at line 79 of file GLBaseGeneticAlgorithm.h.

const GLParametersGeneticAlgorithm* GLBaseGeneticAlgorithm::getParameters (  )  const [inline]

Returns the GA's parameters.

Returns:
current ga's parameters.

Definition at line 93 of file GLBaseGeneticAlgorithm.h.

const GLBaseRanker* GLBaseGeneticAlgorithm::getRanker (  )  const [inline]

Returns the ranker which is currently in use.

Returns:
ranker currently used by this GA.

Definition at line 106 of file GLBaseGeneticAlgorithm.h.

GLBaseRanker* GLBaseGeneticAlgorithm::getRanker (  )  [inline]

Returns the ranker which is currently in use.

Returns:
ranker currently used by this GA.

Definition at line 99 of file GLBaseGeneticAlgorithm.h.

const GLBaseSelectionist* GLBaseGeneticAlgorithm::getSelectionist (  )  const [inline]

Returns the selectionist which is currently in use by GA.

Returns:
the selectionist currently in use by GA.

Definition at line 120 of file GLBaseGeneticAlgorithm.h.

GLBaseSelectionist* GLBaseGeneticAlgorithm::getSelectionist (  )  [inline]

Returns the selectionist which is currently in use by GA.

Returns:
the selectionist currently in use by GA.

Definition at line 113 of file GLBaseGeneticAlgorithm.h.

virtual const GLBaseGaStatus* GLBaseGeneticAlgorithm::getStatus (  )  const [pure virtual]

Returns the current status of the genetic algorithm.

Returns:
pointer to the structure with the current status of the GA.

Implemented in GLGeneticAlgorithmStandard.

const GLBaseVariator* GLBaseGeneticAlgorithm::getVariator (  )  const [inline]

Returns the variator which is currently in use by GA.

Returns:
variator currently in use by GA.

Definition at line 140 of file GLBaseGeneticAlgorithm.h.

GLBaseVariator* GLBaseGeneticAlgorithm::getVariator (  )  [inline]

Returns the variator which is currently in use by GA.

Returns:
variator currently in use by GA.

Definition at line 133 of file GLBaseGeneticAlgorithm.h.

void GLBaseGeneticAlgorithm::reset (  )  [virtual]

Resets the GA after run, so it is possible to make another run with the same class instance. It should delete organisms from population, reset all the GA's elements (breeder, selectionist and variator) and set the status to GA_STATE_INITIALISED. Be careful not to reset the GA while it is running.

Reimplemented in GLGeneticAlgorithmStandard.

Definition at line 95 of file GLBaseGeneticAlgorithm.cpp.

virtual const GLBaseGaStatus* GLBaseGeneticAlgorithm::runGA ( GLBaseOrganismInitialiser initialiser,
GLBaseEvaluator evaluator,
const TListOfStoppers &  stoppers,
bool  bool_operator = GLConstants::OR_OPERATOR 
) [pure virtual]

Runs the GA.

Parameters:
initialiser organism initialiser -- will determine which type of organism will be used for GA. Ideally it should allow to use the same exemplar of GA for solving entirely different problems by changing only initialiser and evaluator.
evaluator class for evaluating the fitness function.
stoppers list of stoppers which determine when the GA is to stop.
bool_operator if == AND_OPERATOR then GA stops when ALL stoppers indicate that, when == OR_OPERATOR (default) then it happens when at least ONE of the stoppers is satisfied.
Returns:
pointer to the structure with the GA status -- all the information necessary for post-processing the results, e.g. best ever organism in GA etc.

Implemented in GLGeneticAlgorithmStandard.

bool GLBaseGeneticAlgorithm::toFinish ( const TListOfStoppers &  stoppers,
bool  bool_operator 
) [protected, virtual]

Method to determine if the criteria for stopping is satisfied. Always return false if getStatus()->m_current_state != GLConstants::GA_STATE_RUNNING. Always returns true if the stoppers list is empty.

Parameters:
stoppers list of stop criteria.
bool_operator if == AND_OPERATOR then return true when ALL stoppers are satisfied, when == OR_OPERATOR return true if at least ONE of the stoppers is satisfied.
Returns:
true if GA is to stop and false otherwise.

Definition at line 112 of file GLBaseGeneticAlgorithm.cpp.


Member Data Documentation

Evaluator currently in use -- made protected, as children will need to access it directly.

Definition at line 197 of file GLBaseGeneticAlgorithm.h.


The documentation for this class was generated from the following files:

Generated on Sat Jun 13 13:58:05 2009 for GenLib by  doxygen 1.5.9