#include <D:/Temp/vs/gal/source/IncrementalAlgorithm.h>
Inherits Algorithm::GaMultithreadingAlgorithm.
Public Member Functions | |
GaIncrementalAlgorithm (GaPopulation *population, const GaMultithreadingAlgorithmParams ¶meters) | |
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 ¶meters) |
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. |
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.
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.
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.
virtual const GaAlgorithmParams& GACALL Algorithm::SimpleAlgorithms::GaIncrementalAlgorithm::GetAlgorithmParameters | ( | ) | const [inline, virtual] |
This method is not thread-safe.
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.
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.
GaMultithreadingAlgorithmParams Algorithm::SimpleAlgorithms::GaIncrementalAlgorithm::_parameters [private] |
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.