Algorithm::SimpleAlgorithms::GaIncrementalAlgorithm Class Reference

Incremental algorithm replaces only specified number of chromosomes at the end of each generation, thus allowing majority of chromosomes to survive. More...

#include <D:/Temp/vs/gal/source/IncrementalAlgorithm.h>

Inherits Algorithm::GaMultithreadingAlgorithm.

List of all members.

Public Member Functions

 GaIncrementalAlgorithm (GaPopulation *population, const GaMultithreadingAlgorithmParams &parameters)
 This constructor initializes algorithm with population on which evolution is performed and with parameters of algorithm.
virtual ~GaIncrementalAlgorithm ()
 The destructor frees memory used by result sets.
virtual const
GaAlgorithmParams &GACALL 
GetAlgorithmParameters () const
 This method is not thread-safe.
virtual GAL_API void GACALL SetAlgorithmParameters (const GaAlgorithmParams &parameters)
 This method should be called from classes which are inheriting this class when user changes algorithm parameters.
virtual const GaPopulation &GACALL GetPopulation (int index) const
 GetPopulation method always returns reference to population which is used by the algorithm and which is by the user when algorithm is constructed.
virtual const GaStatistics &GACALL GetAlgorithmStatistics () const
 GetAlgorithmStatistics method returns reference to object which stores statistical information about population.

Protected Member Functions

virtual void GACALL Initialize ()
 This method initializes population by calling GaPopulation::Initialize method.
virtual GAL_API void GACALL BeforeWorkers ()
 This operation performs selection of chromosomes from population of current generation. It uses selection operation provided by the population.
virtual GAL_API void GACALL WorkStep (int workerId)
 This operation performs coupling operation and produces offspring chromosomes by using previously selected chromosomes as parents. It uses coupling operation provided by the population.
virtual GAL_API void GACALL AfterWorkers ()
 This operation performs replacement of chromosomes from current generation with new offspring chromosomes produced in coupling operation. It uses replacement operation provided by the population.

Private Attributes

GaMultithreadingAlgorithmParams _parameters
 Parameters of genetic algorithm.
GaPopulation_population
 Pointer to population on which evolution is performed.
GaCouplingResultSet_buffer
 Pointer to coupling result set (and selection result set) which is used for storing produced offspring which are going to replace chromosomes from current generation.


Detailed Description

Incremental algorithm replaces only specified number of chromosomes at the end of each generation, thus allowing majority of chromosomes to survive.

This class has no built-in synchronizator, so LOCK_OBJECT and LOCK_THIS_OBJECT macros cannot be used with instances of this class, but all public method and operators are thread-safe.


Constructor & Destructor Documentation

Algorithm::SimpleAlgorithms::GaIncrementalAlgorithm::GaIncrementalAlgorithm ( GaPopulation population,
const GaMultithreadingAlgorithmParams parameters 
) [inline]

This constructor initializes algorithm with population on which evolution is performed and with parameters of algorithm.

Parameters:
population pointer to population on which evolution is performed.
parameters reference to parameters of algorithm.

virtual Algorithm::SimpleAlgorithms::GaIncrementalAlgorithm::~GaIncrementalAlgorithm (  )  [inline, virtual]

The destructor frees memory used by result sets.


Member Function Documentation

virtual const GaAlgorithmParams& GACALL Algorithm::SimpleAlgorithms::GaIncrementalAlgorithm::GetAlgorithmParameters (  )  const [inline, virtual]

This method is not thread-safe.

Returns:
Method returns reference to parameters of algorithm

Implements Algorithm::GaAlgorithm.

void Algorithm::SimpleAlgorithms::GaIncrementalAlgorithm::SetAlgorithmParameters ( const GaAlgorithmParams parameters  )  [virtual]

This method should be called from classes which are inheriting this class when user changes algorithm parameters.

More details are given in specification of GaAlgorithm::SetAlgorithmParameters method.

This method is thread-safe.

Reimplemented from Algorithm::GaMultithreadingAlgorithm.

virtual const GaPopulation& GACALL Algorithm::SimpleAlgorithms::GaIncrementalAlgorithm::GetPopulation ( int  index  )  const [inline, virtual]

GetPopulation method always returns reference to population which is used by the algorithm and which is by the user when algorithm is constructed.

More details are given in specification of GaAlgorithm::GetPopulation method.

This method is thread-safe.

Implements Algorithm::GaAlgorithm.

virtual const GaStatistics& GACALL Algorithm::SimpleAlgorithms::GaIncrementalAlgorithm::GetAlgorithmStatistics (  )  const [inline, virtual]

GetAlgorithmStatistics method returns reference to object which stores statistical information about population.

More details are given in specification of GaAlgorithm::GetAlgorithmStatistics method.

This method is thread-safe.

Implements Algorithm::GaAlgorithm.

virtual void GACALL Algorithm::SimpleAlgorithms::GaIncrementalAlgorithm::Initialize (  )  [inline, protected, virtual]

This method initializes population by calling GaPopulation::Initialize method.

Implements Algorithm::GaBaseAlgorithm.

void Algorithm::SimpleAlgorithms::GaIncrementalAlgorithm::BeforeWorkers (  )  [protected, virtual]

This operation performs selection of chromosomes from population of current generation. It uses selection operation provided by the population.

Reimplemented from Algorithm::GaMultithreadingAlgorithm.

void Algorithm::SimpleAlgorithms::GaIncrementalAlgorithm::WorkStep ( int  workerId  )  [protected, virtual]

This operation performs coupling operation and produces offspring chromosomes by using previously selected chromosomes as parents. It uses coupling operation provided by the population.

Parameters:
workerId identification number of working thread.

Reimplemented from Algorithm::GaMultithreadingAlgorithm.

void Algorithm::SimpleAlgorithms::GaIncrementalAlgorithm::AfterWorkers (  )  [protected, virtual]

This operation performs replacement of chromosomes from current generation with new offspring chromosomes produced in coupling operation. It uses replacement operation provided by the population.

Reimplemented from Algorithm::GaMultithreadingAlgorithm.


Member Data Documentation

Parameters of genetic algorithm.

Pointer to population on which evolution is performed.

Pointer to coupling result set (and selection result set) which is used for storing produced offspring which are going to replace chromosomes from current generation.


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

Genetic Algorithm Library
Coolsoft Software Development