Inheritance diagram for Purple::EvolutionaryAlgorithm:
Definition at line 30 of file EvolutionaryAlgorithm.h.
Enumeration of the available optimization operators for fitness assignment.
Definition at line 39 of file EvolutionaryAlgorithm.h.
Enumeration of the available optimization operators for selection.
Definition at line 43 of file EvolutionaryAlgorithm.h.
Enumeration of the available optimization operators for recombination.
Definition at line 47 of file EvolutionaryAlgorithm.h.
Enumeration of the available optimization operators for mutation.
Definition at line 51 of file EvolutionaryAlgorithm.h.
Purple::EvolutionaryAlgorithm::EvolutionaryAlgorithm | ( | ObjectiveFunction * | newObjectiveFunction | ) |
General constructor. It creates an evolutionary optimization algorithm object associated to an objective function object. Population is initialized at random within the objective function domain. The constructor also initializes the class members to their default values:
Optimization operators:
Optimization parameters:
Stopping criteria:
User stuff:
newObjectiveFunction,: | Pointer to an objective function object. |
Definition at line 63 of file EvolutionaryAlgorithm.cpp.
Purple::EvolutionaryAlgorithm::EvolutionaryAlgorithm | ( | void | ) |
Default constructor. It creates an evolutionary algorithm object not associated to any objective function object. It also initializes the class members to their default values:
Optimization operators:
Optimization parameters:
Stopping criteria:
User stuff:
Definition at line 193 of file EvolutionaryAlgorithm.cpp.
Purple::EvolutionaryAlgorithm::~EvolutionaryAlgorithm | ( | void | ) | [virtual] |
int Purple::EvolutionaryAlgorithm::getPopulationSize | ( | void | ) |
This method returns the number of individuals in the population.
Definition at line 248 of file EvolutionaryAlgorithm.cpp.
Matrix< double > Purple::EvolutionaryAlgorithm::getPopulation | ( | void | ) |
This method returns the population Matrix.
Definition at line 445 of file EvolutionaryAlgorithm.cpp.
Vector< double > Purple::EvolutionaryAlgorithm::getEvaluation | ( | void | ) |
This method returns the actual evaluation value of all individuals in the population.
Definition at line 459 of file EvolutionaryAlgorithm.cpp.
Vector< double > Purple::EvolutionaryAlgorithm::getFitness | ( | void | ) |
This method returns the actual fitness value of all individuals in the population.
Definition at line 472 of file EvolutionaryAlgorithm.cpp.
Vector< bool > Purple::EvolutionaryAlgorithm::getSelection | ( | void | ) |
This method returns the actual selection value of all individuals in the population.
Definition at line 485 of file EvolutionaryAlgorithm.cpp.
double Purple::EvolutionaryAlgorithm::getSelectivePressure | ( | void | ) |
This method returns the selective pressure value.
Definition at line 653 of file EvolutionaryAlgorithm.cpp.
double Purple::EvolutionaryAlgorithm::getRecombinationSize | ( | void | ) |
This method returns the recombination size value.
Definition at line 666 of file EvolutionaryAlgorithm.cpp.
double Purple::EvolutionaryAlgorithm::getMutationRate | ( | void | ) |
This method returns the mutation rate value.
Definition at line 679 of file EvolutionaryAlgorithm.cpp.
double Purple::EvolutionaryAlgorithm::getMutationRange | ( | void | ) |
This method returns the mutation range value.
Definition at line 692 of file EvolutionaryAlgorithm.cpp.
int Purple::EvolutionaryAlgorithm::getMaximumNumberOfGenerations | ( | void | ) |
int Purple::EvolutionaryAlgorithm::getShowPeriod | ( | void | ) |
This method returns the number of generations between the evolutionary algorithm optimization showing progress.
Definition at line 356 of file EvolutionaryAlgorithm.cpp.
Vector< double > Purple::EvolutionaryAlgorithm::getMeanEvaluationHistory | ( | void | ) |
This method returns a history with the mean evaluation of the population during optimization.
getStandardDeviationOfEvaluationHistory(void).
Definition at line 317 of file EvolutionaryAlgorithm.cpp.
Vector< double > Purple::EvolutionaryAlgorithm::getStandardDeviationEvaluationHistory | ( | void | ) |
This method returns a history with the standard deviation of the population evaluation during optimization.
Definition at line 331 of file EvolutionaryAlgorithm.cpp.
Vector< double > Purple::EvolutionaryAlgorithm::getBestEvaluationHistory | ( | void | ) |
This method returns a history with the evaluation value of the best individual ever during optimization.
Definition at line 345 of file EvolutionaryAlgorithm.cpp.
EvolutionaryAlgorithm::FitnessAssignmentMethod Purple::EvolutionaryAlgorithm::getFitnessAssignmentMethod | ( | void | ) |
This method returns the fitness assignment method used for optimization.
Definition at line 706 of file EvolutionaryAlgorithm.cpp.
EvolutionaryAlgorithm::SelectionMethod Purple::EvolutionaryAlgorithm::getSelectionMethod | ( | void | ) |
This method returns the selection method used for optimization.
Definition at line 720 of file EvolutionaryAlgorithm.cpp.
EvolutionaryAlgorithm::RecombinationMethod Purple::EvolutionaryAlgorithm::getRecombinationMethod | ( | void | ) |
This method returns the recombination method used for optimization.
Definition at line 733 of file EvolutionaryAlgorithm.cpp.
EvolutionaryAlgorithm::MutationMethod Purple::EvolutionaryAlgorithm::getMutationMethod | ( | void | ) |
This method returns the mutation method used for optimization.
Definition at line 746 of file EvolutionaryAlgorithm.cpp.
void Purple::EvolutionaryAlgorithm::setPopulationSize | ( | int | newPopulationSize | ) |
This method sets a new population with a new number of individuals. The new population size must be an even number equal or greater than four.
newPopulationSize,: | Number of individuals in the population. This must be an even number equal or greater than four. |
Definition at line 370 of file EvolutionaryAlgorithm.cpp.
void Purple::EvolutionaryAlgorithm::setPopulation | ( | Matrix< double > | newPopulation | ) |
This method sets a new population.
newPopulation,: | Population Matrix. |
Definition at line 497 of file EvolutionaryAlgorithm.cpp.
void Purple::EvolutionaryAlgorithm::setEvaluation | ( | Vector< double > | newEvaluation | ) |
This method sets a new population evaluation Vector.
newEvaluation,: | Population evaluation values. |
Definition at line 536 of file EvolutionaryAlgorithm.cpp.
void Purple::EvolutionaryAlgorithm::setFitness | ( | Vector< double > | newFitness | ) |
This method sets a new population fitness Vector.
newFitness,: | Population fitness values. |
Definition at line 560 of file EvolutionaryAlgorithm.cpp.
void Purple::EvolutionaryAlgorithm::setSelection | ( | Vector< bool > | newSelection | ) |
This method sets a new population selection Vector.
newSelection,: | Population selection values. |
Definition at line 584 of file EvolutionaryAlgorithm.cpp.
void Purple::EvolutionaryAlgorithm::setSelectivePressure | ( | double | newSelectivePressure | ) |
This method sets a new value for the selective pressure parameter. Linear ranking allows values for the selective pressure between 1 and 2. Non linear ranking allows values for the selective pressure between 1 and [population size] - 2.
newSelectivePressure,: | Selective pressure value. This must be between 1 and 2 for linear ranking fitness assignment and between 1 1 and [population size] - 2 for non linear ranking fitness assignment. |
Definition at line 766 of file EvolutionaryAlgorithm.cpp.
void Purple::EvolutionaryAlgorithm::setRecombinationSize | ( | double | newRecombinationSize | ) |
This method sets a new value for the recombination size parameter. The recombination size value must be equal or greater than 0.
newRecombinationSize,: | Recombination size value. This must be equal or greater than 0. |
Definition at line 820 of file EvolutionaryAlgorithm.cpp.
void Purple::EvolutionaryAlgorithm::setMutationRate | ( | double | newMutationRate | ) |
This method sets a new value for the mutation rate parameter. The mutation rate value must be between 0 and 1.
newMutationRate,: | Mutation rate value. This must be equal or greater than 0 less or equal to 1. |
Definition at line 850 of file EvolutionaryAlgorithm.cpp.
void Purple::EvolutionaryAlgorithm::setMutationRange | ( | double | newMutationRange | ) |
This method sets a new value for the mutation range parameter. The mutation range value must be 0 or a positive number.
newMutationRange,: | Mutation range value. This must be equal or greater than 0. |
Definition at line 879 of file EvolutionaryAlgorithm.cpp.
void Purple::EvolutionaryAlgorithm::setFitnessAssignmentMethod | ( | EvolutionaryAlgorithm::FitnessAssignmentMethod | newFitnessAssignmentMethod | ) |
This method sets a new fitness assignment method to be used for optimization.
newFitnessAssignmentMethod,: | Fitness assignment method chosen for optimization. |
Definition at line 909 of file EvolutionaryAlgorithm.cpp.
void Purple::EvolutionaryAlgorithm::setSelectionMethod | ( | EvolutionaryAlgorithm::SelectionMethod | newSelectionMethod | ) |
This method sets a new selection method to be used for optimization.
newSelectionMethod,: | Selection method. |
Definition at line 925 of file EvolutionaryAlgorithm.cpp.
void Purple::EvolutionaryAlgorithm::setRecombinationMethod | ( | EvolutionaryAlgorithm::RecombinationMethod | newRecombinationMethod | ) |
This method sets a new recombination method to be used for optimization.
newRecombinationMethod,: | Recombination method chosen for optimization. |
Definition at line 941 of file EvolutionaryAlgorithm.cpp.
void Purple::EvolutionaryAlgorithm::setMutationMethod | ( | EvolutionaryAlgorithm::MutationMethod | newMutationMethod | ) |
This method sets a new mutation method to be used for optimization.
newMutationMethod,: | Mutation method chosen for optimization. |
Definition at line 958 of file EvolutionaryAlgorithm.cpp.
void Purple::EvolutionaryAlgorithm::setMaximumNumberOfGenerations | ( | int | newMaximumNumberOfGenerations | ) |
This method sets a new maximum number of generations in the evolutionary algorithm optimization process.
newMaximumNumberOfGenerations,: | Maximum number of generations. |
Definition at line 263 of file EvolutionaryAlgorithm.cpp.
void Purple::EvolutionaryAlgorithm::setShowPeriod | ( | int | newShowPeriod | ) |
This method sets a new number of generations between the optimization showing progress.
newShowPeriod,: | Number of generations between the optimization showing progress. |
Definition at line 290 of file EvolutionaryAlgorithm.cpp.
Vector< double > Purple::EvolutionaryAlgorithm::getIndividual | ( | int | i | ) |
This method returns the Vector of free parameters corresponding to the individual i in the population.
i,: | Index of individual in the population. |
Definition at line 610 of file EvolutionaryAlgorithm.cpp.
void Purple::EvolutionaryAlgorithm::setIndividual | ( | int | i, | |
Vector< double > | individual | |||
) |
This method sets a new Vector of free parameters to the individual i in the population.
i,: | Index of individual in the population. | |
individual,: | Vector of free parameters to be assigned to individual i. |
Definition at line 633 of file EvolutionaryAlgorithm.cpp.
void Purple::EvolutionaryAlgorithm::initPopulationAtRandom | ( | void | ) |
This method initializes all the individuals in the population at random, with values comprised between -1 and 1.
Definition at line 973 of file EvolutionaryAlgorithm.cpp.
void Purple::EvolutionaryAlgorithm::initPopulationAtRandom | ( | double | minimumValue, | |
double | maximumValue | |||
) |
This method initializes all the individuals in the population at random, with values comprised between a minimum and a maximum value.
minimumValue,: | Minimum initialization value. | |
maximumValue,: | Maximum initialization value. |
Definition at line 1008 of file EvolutionaryAlgorithm.cpp.
void Purple::EvolutionaryAlgorithm::initPopulationAtRandom | ( | Vector< double > | minimumValue, | |
Vector< double > | maximumValue | |||
) |
This method initializes the free parameters of all the individuals in the population at random, with values comprised between different minimum and maximum values for each variable.
minimumValue,: | Minimum initialization value. | |
maximumValue,: | Maximum initialization value. |
Definition at line 1044 of file EvolutionaryAlgorithm.cpp.
void Purple::EvolutionaryAlgorithm::initPopulationAtRandom | ( | Matrix< double > | minimumAndMaximumValues | ) |
This method initializes the free parameters of all the individuals in the population at random, with values comprised between different minimum and maximum values for each variable and from a single Matrix.
minimumAndMaximumValues,: | Minimum and maximum initialization values. |
Definition at line 1094 of file EvolutionaryAlgorithm.cpp.
void Purple::EvolutionaryAlgorithm::evaluatePopulation | ( | void | ) |
This method evaluates the objective function of all individuals in the population. Results are stored in the evaluation Vector.
Definition at line 1146 of file EvolutionaryAlgorithm.cpp.
void Purple::EvolutionaryAlgorithm::performLinearRankingFitnessAssignment | ( | void | ) |
This method ranks all individuals in the population by their evaluation value, so that the least fit individual has rank 1 and the fittest individual has rank [population size]. It then assigns them a fitness value linearly proportional to their rank. Results are stored in the fitness Vector.
Definition at line 1185 of file EvolutionaryAlgorithm.cpp.
void Purple::EvolutionaryAlgorithm::performNonLinearRankingFitnessAssignment | ( | void | ) |
This method ranks all individuals in the population by their evaluation value, so that the least fit individual has rank 1 and the fittest individual has rank population size. Please, do not use this method. It is not yet implemented.
Definition at line 1243 of file EvolutionaryAlgorithm.cpp.
void Purple::EvolutionaryAlgorithm::performRouletteWheelSelection | ( | void | ) |
This metod performs selection with roulette wheel selection. It selects half of the individuals from the population. Results are stored in the selection Vector.
Definition at line 1265 of file EvolutionaryAlgorithm.cpp.
void Purple::EvolutionaryAlgorithm::performStochasticUniversalSamplingSelection | ( | void | ) |
This metod performs selection with stochastic universal sampling. It selects half of the individuals from the population. Results are stored in the selection vector.
Definition at line 1349 of file EvolutionaryAlgorithm.cpp.
void Purple::EvolutionaryAlgorithm::performIntermediateRecombination | ( | void | ) |
This method performs intermediate recombination between pairs of selected individuals to generate a new population. Each selected individual is to be recombined with two other selected individuals chosen at random. Results are stored in the population matrix.
Definition at line 1443 of file EvolutionaryAlgorithm.cpp.
void Purple::EvolutionaryAlgorithm::performLineRecombination | ( | void | ) |
This method performs line recombination between pairs of selected individuals to generate a new population. Each selected individual is to be recombined with two other selected individuals chosen at random. Results are stored in the population matrix.
Definition at line 1571 of file EvolutionaryAlgorithm.cpp.
void Purple::EvolutionaryAlgorithm::performNormalMutation | ( | void | ) |
This method performs normal mutation to all individuals in order to generate a new population. It uses the Box-Muller transformation to generate random numbers with normal distribution. Results are stored in the population matrix.
Definition at line 1691 of file EvolutionaryAlgorithm.cpp.
void Purple::EvolutionaryAlgorithm::performUniformMutation | ( | void | ) |
This method performs uniform mutation to all individuals in order to generate a new population. Results are stored in the population matrix.
Definition at line 1751 of file EvolutionaryAlgorithm.cpp.
Vector< double > Purple::EvolutionaryAlgorithm::getMinimalArgument | ( | void | ) | [virtual] |
This method optimizes the objective function with the evolutionary algorithm. This process occurs according to the optimization operators and their related parameters.
Implements Purple::OptimizationAlgorithm.
Definition at line 1796 of file EvolutionaryAlgorithm.cpp.
void Purple::EvolutionaryAlgorithm::print | ( | void | ) |
This method prints to the screen the members of the evolutionary algorithm object.
Optimization operators:
Optimization parameters:
Stopping criteria:
User stuff:
Definition at line 2178 of file EvolutionaryAlgorithm.cpp.
void Purple::EvolutionaryAlgorithm::load | ( | char * | filename | ) |
This method loads an evolutionary $algorithm object from a data file. Please mind about the file format, wich is specified in the User's Guide.
Optimization operators:
Optimization parameters:
Stopping criteria:
User stuff:
filename,: | Filename. |
Definition at line 2520 of file EvolutionaryAlgorithm.cpp.
void Purple::EvolutionaryAlgorithm::save | ( | char * | filename | ) |
This method saves the evolutionary algorithm object to a data file.
Optimization operators:
Optimization parameters:
Stopping criteria:
User stuff:
filename,: | Filename. |
Definition at line 2339 of file EvolutionaryAlgorithm.cpp.
void Purple::EvolutionaryAlgorithm::saveOptimizationHistory | ( | char * | filename | ) |
This method saves the optimization history to a data file:
filename,: | Filename. |
Definition at line 2745 of file EvolutionaryAlgorithm.cpp.
int Purple::EvolutionaryAlgorithm::populationSize [private] |
Matrix<double> Purple::EvolutionaryAlgorithm::population [private] |
Vector<double> Purple::EvolutionaryAlgorithm::evaluation [private] |
Vector<double> Purple::EvolutionaryAlgorithm::fitness [private] |
Vector<bool> Purple::EvolutionaryAlgorithm::selection [private] |
double Purple::EvolutionaryAlgorithm::selectivePressure [private] |
Selective pressure. Linear ranking allows values for the selective pressure between 1 and 2. Non linear ranking allows values for the selective pressure between 1 and [population size] - 2.
Definition at line 86 of file EvolutionaryAlgorithm.h.
double Purple::EvolutionaryAlgorithm::recombinationSize [private] |
Recombination size. The recombination size value must be equal or greater than 0.
Definition at line 91 of file EvolutionaryAlgorithm.h.
double Purple::EvolutionaryAlgorithm::mutationRate [private] |
Mutation rate. The mutation rate value must be between 0 and 1.
Definition at line 96 of file EvolutionaryAlgorithm.h.
double Purple::EvolutionaryAlgorithm::mutationRange [private] |
Mutation range. The mutation range value must be 0 or a positive number.
Definition at line 101 of file EvolutionaryAlgorithm.h.
int Purple::EvolutionaryAlgorithm::showPeriod [private] |
Number of generations between showing progress.
Definition at line 111 of file EvolutionaryAlgorithm.h.
Vector<double> Purple::EvolutionaryAlgorithm::meanEvaluationHistory [private] |
Vector<double> Purple::EvolutionaryAlgorithm::standardDeviationEvaluationHistory [private] |
Standard deviation of evaluation optimization history.
Definition at line 119 of file EvolutionaryAlgorithm.h.
Vector<double> Purple::EvolutionaryAlgorithm::bestEvaluationHistory [private] |
Fitness assignment optimization operators enumeration.
Definition at line 128 of file EvolutionaryAlgorithm.h.
Selection optimization operators enumeration.
Definition at line 132 of file EvolutionaryAlgorithm.h.
Recombination optimization operators enumeration.
Definition at line 136 of file EvolutionaryAlgorithm.h.
Mutation optimization operators enumeration.
Definition at line 140 of file EvolutionaryAlgorithm.h.