#include <GLBaseGeneticAlgorithm.h>
Definition at line 23 of file GLBaseGeneticAlgorithm.h.
GLBaseGeneticAlgorithm::GLBaseGeneticAlgorithm | ( | const GLParametersGeneticAlgorithm & | parameters, | |
GLFactory * | factory | |||
) |
Constructor. Creates the genetic algorithm.
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.). |
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.
const GLBaseBreeder* GLBaseGeneticAlgorithm::getBreeder | ( | ) | const [inline] |
Returns the current breeder used by GA.
Definition at line 52 of file GLBaseGeneticAlgorithm.h.
GLBaseBreeder* GLBaseGeneticAlgorithm::getBreeder | ( | ) | [inline] |
Returns the current breeder used by GA.
Definition at line 45 of file GLBaseGeneticAlgorithm.h.
const GLBaseCrossover* GLBaseGeneticAlgorithm::getCrossover | ( | ) | const [inline] |
Returns the GA's crossover.
Definition at line 66 of file GLBaseGeneticAlgorithm.h.
GLBaseCrossover* GLBaseGeneticAlgorithm::getCrossover | ( | ) | [inline] |
Returns the GA's crossover.
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.
Definition at line 86 of file GLBaseGeneticAlgorithm.h.
GLBaseMutator* GLBaseGeneticAlgorithm::getMutator | ( | ) | [inline] |
Returns the mutator currently in use by GA.
Definition at line 79 of file GLBaseGeneticAlgorithm.h.
const GLParametersGeneticAlgorithm* GLBaseGeneticAlgorithm::getParameters | ( | ) | const [inline] |
Returns the 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.
Definition at line 106 of file GLBaseGeneticAlgorithm.h.
GLBaseRanker* GLBaseGeneticAlgorithm::getRanker | ( | ) | [inline] |
Returns the ranker which is currently in use.
Definition at line 99 of file GLBaseGeneticAlgorithm.h.
const GLBaseSelectionist* GLBaseGeneticAlgorithm::getSelectionist | ( | ) | const [inline] |
Returns the selectionist which is 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.
Definition at line 113 of file GLBaseGeneticAlgorithm.h.
virtual const GLBaseGaStatus* GLBaseGeneticAlgorithm::getStatus | ( | ) | const [pure virtual] |
Returns the current status of the genetic algorithm.
Implemented in GLGeneticAlgorithmStandard.
const GLBaseVariator* GLBaseGeneticAlgorithm::getVariator | ( | ) | const [inline] |
Returns the variator which is 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.
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.
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. |
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.
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. |
Definition at line 112 of file GLBaseGeneticAlgorithm.cpp.
GLBaseEvaluator* GLBaseGeneticAlgorithm::m_evaluator [protected] |
Evaluator currently in use -- made protected, as children will need to access it directly.
Definition at line 197 of file GLBaseGeneticAlgorithm.h.