|
dignea
1.0.0
Diverse Instance Generator with Novelty Search and Evolutionary Algorithms
|
Simulated Annealing Algorithm. More...
#include <SimulatedAnnealing.h>
Public Member Functions | |
| SimulatedAnnealing (const int &maxEvaluations, const float &initialTemp, const float &tempVariation) | |
| Construct a new Simulated Annealing object with all the parameters. More... | |
| void | run () override |
| Runs the Simulated Annealing algorithm during maxEvaluations. More... | |
| string | getName () const override |
| Get the Name. More... | |
| string | getID () const override |
| Get the ID of the algorithm. More... | |
| Front< S > | getResults () const override |
| Returns the results obtained by the SA algorithm at the end of the process. More... | |
| void | setProblem (shared_ptr< Problem< S >> prob) override |
| Sets the problem to solve using Simulated Annealing. More... | |
| void | setProblem (Problem< S > *prob) override |
| Sets the problem to solve using Simulated Annealing. More... | |
| float | getTempVariation () const |
| Get the temperature variation constant for each generation. More... | |
| void | setTempVariation (float tempVariation) |
| Set the temperature variation constant for each generation. More... | |
| float | getCurrentTemp () const |
| Get the current temperature. More... | |
| void | setCurrentTemp (float currentTemp) |
| Set the current temperature of the process. More... | |
| void | setPopulationSize (const int &pSize) |
| This methods is not implemented for this class. The population size of a SA algorithm is always 1. More... | |
Public Member Functions inherited from AbstractEA< S > | |
| AbstractEA () | |
| Construct a new Abstract EA object with default parameter values. More... | |
| AbstractEA (const int &maxEvals, const int &popsize) | |
| AbstractEA constructor which initialises the parameters maxEvalautions and populationSize. More... | |
| AbstractEA (unique_ptr< PopulationEvaluator< S >>, const int &maxEvals, const int &popsize) | |
| AbstractEA constructor which initialises the parameters maxEvalautions, the populationSize and the evaluator approach. More... | |
| virtual json | to_json () const |
| Generates and returns the JSON representation of the EA. More... | |
| int | getPopulationSize () const |
| Get the population size. More... | |
| void | setPopulationSize (int pSize) |
| Setter to update the population size. More... | |
| double | getElapsedTime () const |
| Get the elapsed time of the evolutionary process. More... | |
| const vector< S > & | getPopulation () const |
| Gets a reference of the population. More... | |
| int | getMaxEvaluations () const |
| Get the maximum number of evaluations to perform. More... | |
| void | setMaxEvaluations (int maxEval) |
| Set a new maximum number of evaluations to perform. More... | |
| const Problem< S > * | getProblem () const |
| Gets a pointer to the problem which is being solved. More... | |
| PopulationEvaluator< S > * | getEvaluator () const |
| Gets a pointer to the population evaluator system. More... | |
| void | setEvaluator (unique_ptr< PopulationEvaluator< S >> eval) |
| Updates the population evaluator system with the unique_ptr. The method takes the ownership of the object behind. More... | |
| int | getPerformedEvaluations () const |
| Get the performed evaluations. More... | |
| void | setPerformedEvaluations (int pEvals) |
| Set the Performed Evaluations. Useful for the updateProgress method. More... | |
| void | setPopulation (const vector< S > &pop) |
| Set the Population. More... | |
| virtual Evolution< S > | getEvolution () const |
| Get the Evolution data. More... | |
| int | getPrintingInterval () const |
| Get the interval of checkpoints. More... | |
Protected Member Functions | |
| void | initProgress () override |
| Initialises the evolutionary process. Sets the number of performedEvaluations to 1. More... | |
| void | updateProgress () override |
| Updates the evolutionary process by increasing the performedEvaluations in two. More... | |
| void | finishProgress () override |
| Finishes the evolutionary process and computes the elapsed time. More... | |
| bool | isStoppingConditionReached () override |
| Checks whether the maximum number of evaluations have been performed. More... | |
| void | createInitialPopulation () override |
| Creates the initial population for the SA. The population of the SA is just one individual. More... | |
| void | evaluatePopulation (vector< S > &vector1) override |
| Evaluates the entire population of solutions. This is a virtual method that must be implemented in the subclasses to adapt special cases. | |
| S | evaluateInds (S &popInd, S &offspring) |
| Evaluates the parent and offspring individuals at each generation. More... | |
Protected Member Functions inherited from AbstractEA< S > | |
| virtual void | updateEvolution (vector< S > &pop) |
| virtual void | updateEvolution (const int &checkpoint, vector< S > &) |
Additional Inherited Members | |
Static Public Attributes inherited from AbstractEA< S > | |
| static const int | DEFAULT_POPULATION_SIZE = 100 |
| Default population size equal to 100 individuals. More... | |
| static const int | DEFAULT_EVALUATIONS_LIMIT = 100000 |
| Default evaluation limit equal to 100000 evaluations. More... | |
| static const std::string | NAME = "Algorithm" |
| static const std::string | MAX_EVALUATIONS = "Max Evaluations" |
| static const std::string | POP_SIZE = "Population Size" |
| static const std::string | ELAPSED_TIME = "Elapsed Time" |
| static const std::string | EVALUATOR = "Evaluator" |
| static const int | EVOLUTION_SIZE = 10 |
Protected Attributes inherited from AbstractEA< S > | |
| int | maxEvaluations |
| int | performedEvaluations |
| int | populationSize |
| vector< S > | population |
| shared_ptr< Problem< S > > | problem |
| unique_ptr< PopulationEvaluator< S > > | evaluator |
| Evolution< S > | evolution |
| AvgEvolution< S > | avgEvolution |
| std::chrono::system_clock::time_point | startTime |
| std::chrono::system_clock::time_point | endTime |
| double | elapsedTime |
| int | nextCheckpoint |
| int | evolutionInterval |
Simulated Annealing Algorithm.
| S | Type of individual in the population |
| SimulatedAnnealing< S >::SimulatedAnnealing | ( | const int & | maxEvaluations, |
| const float & | initialTemp, | ||
| const float & | tempVariation | ||
| ) |
Construct a new Simulated Annealing object with all the parameters.
| S |
| maxEvaluations | |
| initialTemp | |
| tempVariation |
|
overrideprotectedvirtual |
Creates the initial population for the SA. The population of the SA is just one individual.
| S |
Implements AbstractEA< S >.
|
protected |
Evaluates the parent and offspring individuals at each generation.
| S |
| popInd | |
| offspring |
|
overrideprotectedvirtual |
Finishes the evolutionary process and computes the elapsed time.
| S |
Implements AbstractEA< S >.
|
inline |
Get the current temperature.
|
inlineoverridevirtual |
|
inlineoverridevirtual |
|
overridevirtual |
Returns the results obtained by the SA algorithm at the end of the process.
| S |
Implements AbstractEA< S >.
|
inline |
Get the temperature variation constant for each generation.
|
overrideprotectedvirtual |
Initialises the evolutionary process. Sets the number of performedEvaluations to 1.
| S |
Implements AbstractEA< S >.
|
overrideprotectedvirtual |
Checks whether the maximum number of evaluations have been performed.
| S |
Implements AbstractEA< S >.
|
overridevirtual |
Runs the Simulated Annealing algorithm during maxEvaluations.
| S |
Implements AbstractEA< S >.
|
inline |
Set the current temperature of the process.
| currentTemp |
| void SimulatedAnnealing< S >::setPopulationSize | ( | const int & | pSize | ) |
This methods is not implemented for this class. The population size of a SA algorithm is always 1.
| S |
| prob |
|
overridevirtual |
Sets the problem to solve using Simulated Annealing.
| S |
| prob |
Reimplemented from AbstractEA< S >.
|
overridevirtual |
Sets the problem to solve using Simulated Annealing.
| S |
| prob |
Reimplemented from AbstractEA< S >.
|
inline |
Set the temperature variation constant for each generation.
| tempVariation |
|
overrideprotectedvirtual |
Updates the evolutionary process by increasing the performedEvaluations in two.
| S |
Implements AbstractEA< S >.