14 #ifndef __EVOLUTIONARYALGORITHM_H__
15 #define __EVOLUTIONARYALGORITHM_H__
30 #include "training_algorithm.h"
31 #include "performance_functional.h"
412 tinyxml2::XMLDocument*
to_XML(
void)
const;
413 void from_XML(
const tinyxml2::XMLDocument&);
Vector< Matrix< double > > population_history
History of the population matrix over the generations.
const SelectionMethod & get_selection_method(void) const
Returns the selection method used for training.
void set_population_size(const size_t &)
void set_reserve_mean_performance_history(const bool &)
double final_best_performance
Performance of the best individual ever.
const double & get_mutation_range(void) const
Returns the mutation range value.
void set_selective_pressure(const double &)
void set_maximum_generations_number(const size_t &)
bool reserve_best_individual_history
void set_reserve_generalization_performance_history(const bool &)
const double & get_mean_performance_goal(void) const
Returns the mean performance value of the population at which training will stop. ...
const double & get_mutation_rate(void) const
Returns the mutation rate value.
void set_selection(const Vector< bool > &)
const size_t & get_maximum_generations_number(void) const
Returns the maximum number of generations to train.
const double & get_best_performance_goal(void) const
EvolutionaryAlgorithmResults(void)
Default constructor.
Vector< double > calculate_population_norm(void) const
Returns a vector containing the norm of each individual in the population.
const bool & get_reserve_population_history(void) const
Returns true if the population history vector of matrices is to be reserved, and false otherwise...
size_t get_population_size(void) const
Returns the number of individuals in the population.
void set_reserve_all_training_history(const bool &)
const double & get_standard_deviation_performance_goal(void) const
Returns the standard deviation of the performance at which training will stop.
std::string write_training_algorithm_type(void) const
This method writes a string with the type of training algoritm.
void initialize_population(const double &)
const bool & get_reserve_standard_deviation_norm_history(void) const
void evolve_population(void)
Generates a new population matrix by applying fitness assignment, selection, recombination and mutati...
const double & get_error_parameters_norm(void) const
bool reserve_standard_deviation_norm_history
True if the standard deviation of norm history vector is to be reserved, false otherwise.
size_t maximum_generalization_performance_decreases
tinyxml2::XMLDocument * to_XML(void) const
Vector< double > get_individual(const size_t &) const
void set_reserve_mean_norm_history(const bool &)
const RecombinationMethod & get_recombination_method(void) const
Returns the recombination method used for training.
double selective_pressure
void set_fitness(const Vector< double > &)
void set_standard_deviation_performance_goal(const double &)
void perform_intermediate_recombination(void)
void initialize_random(void)
void set_reserve_elapsed_time_history(const bool &)
const Vector< double > & get_performance(void) const
Returns the actual performance value of all individuals in the population.
double final_mean_performance
Final mean population performance.
void perform_linear_ranking_fitness_assignment(void)
Vector< double > standard_deviation_norm_history
History of the standard deviation of the individuals norm over the generations.
void set_reserve_best_individual_history(const bool &)
void set_performance(const Vector< double > &)
void perform_recombination(void)
Recombinates the selected individuals according to the recombination operator.
void set_selection_method(const SelectionMethod &)
bool reserve_generalization_performance_history
True if the Generalization performance history vector is to be reserved, false otherwise.
double maximum_time
Maximum training time. It is used as a stopping criterion.
double final_standard_deviation_performance
Final standard deviation of the population performance.
EvolutionaryAlgorithm * evolutionary_algorithm_pointer
Pointer to the evolutionary algorithm object for which the training results are to be stored...
const FitnessAssignmentMethod & get_fitness_assignment_method(void) const
Returns the fitness assignment method used for training.
void resize_training_history(const size_t &)
EvolutionaryAlgorithmResults * perform_training(void)
Vector< double > mean_norm_history
History of the mean norm of the individuals over the generations.
EvolutionaryAlgorithm(void)
const bool & get_reserve_best_individual_history(void) const
Returns true if the best individual history vector of vectors is to be reserved, and false otherwise...
bool reserve_elapsed_time_history
True if the elapsed time history vector is to be reserved, false otherwise.
Matrix< std::string > to_string_matrix(void) const
void set_reserve_population_history(const bool &)
Vector< bool > selection
Selected individuals in population.
void evaluate_population(void)
std::string write_mutation_method(void) const
Returns a string with the name of the method used for mutation.
bool reserve_population_history
Vector< double > mean_performance_history
History of the mean performance of the individuals over the generations.
const double & get_warning_parameters_norm(void) const
void set_population(const Matrix< double > &)
void perform_uniform_mutation(void)
std::string to_string(void) const
Returns a string representation of the current evolutionary algorithm resutls structure.
double final_mean_norm
Final mean norm of the population.
const MutationMethod & get_mutation_method(void) const
Returns the mutation method used for training.
Vector< double > best_norm_history
History of the norm of the best individual over the generations.
void perform_mutation(void)
Mutates the population matrix according to the mutation operator.
Vector< Vector< double > > performance_history
History of the population performance over the generations.
void set_mutation_method(const MutationMethod &)
void set_warning_parameters_norm(const double &)
Vector< double > generalization_performance_history
History of the generalization performance of the best individual over each generations.
virtual ~EvolutionaryAlgorithmResults(void)
Destructor.
bool reserve_standard_deviation_performance_history
True if the standard deviation of performance history vector is to be reserved, false otherwise...
bool reserve_best_norm_history
True if the best norm history vector is to be reserved, false otherwise.
virtual ~EvolutionaryAlgorithm(void)
Destructor.
void set_individual(const size_t &, const Vector< double > &)
const double & get_recombination_size(void) const
Returns the recombination size value.
void set_recombination_size(const double &)
double elapsed_time
Total elapsed time in the training process.
std::string write_recombination_method(void) const
Returns a string with the name of the method used for recombination.
SelectionMethod selection_method
Selection training operators enumeration.
void randomize_population_normal(void)
void set_display_period(const size_t &)
double warning_parameters_norm
Value for the parameters norm at which a warning message is written to the screen.
const double & get_maximum_time(void) const
Returns the maximum training time.
const bool & get_reserve_best_performance_history(void) const
Returns true if the best performance history vector is to be reserved, and false otherwise.
double final_best_norm
Final norm of the best individual ever.
const bool & get_reserve_best_norm_history(void) const
void set_maximum_generalization_performance_decreases(const size_t &)
void set_mutation_range(const double &)
MutationMethod mutation_method
Mutation training operators enumeration.
void set_error_parameters_norm(const double &)
void perform_normal_mutation(void)
double final_standard_deviation_norm
Final standard deviation of the population norm.
const double & get_selective_pressure(void) const
Returns the selective pressure value.
double calculate_standard_deviation_performance(void) const
Returns the standard deviation value of the individuals performance.
void set_fitness_assignment_method(const FitnessAssignmentMethod &)
bool reserve_best_performance_history
True if the best performance history vector is to be reserved, false otherwise.
Matrix< std::string > write_final_results(const size_t &precision=3) const
Returns a default (empty) string matrix with the final results from training.
Vector< double > performance
Performance of population.
std::string write_fitness_assignment_method(void) const
Returns a string with the name of the method used for fitness assignment.
size_t maximum_generations_number
Maximum number of generations to perform_training.
void perform_line_recombination(void)
const bool & get_reserve_standard_deviation_performance_history(void) const
bool reserve_mean_norm_history
True if the mean norm history vector is to be reserved, false otherwise.
Vector< double > standard_deviation_performance_history
History of the standard deviation of the population performance over the generations.
void set_reserve_standard_deviation_performance_history(const bool &)
void set_recombination_method(const RecombinationMethod &)
void from_XML(const tinyxml2::XMLDocument &)
double standard_deviation_performance_goal
void perform_selection(void)
Selects for recombination some individuals from the population according to the selection operator...
FitnessAssignmentMethod
Enumeration of the available training operators for fitness assignment.
double calculate_mean_performance(void) const
Returns the mean value of the individuals performance.
size_t generations_number
Number of generations needed by the evolutionary algorithm.
Vector< double > best_performance_history
History of the performance of the best individual over each generations.
double best_performance_goal
Best goal value for the performance. It is used as a stopping criterion.
const bool & get_reserve_elapsed_time_history(void) const
Returns true if the elapsed time history vector is to be reserved, and false otherwise.
Vector< double > fitness
Fitness of population.
Matrix< double > population
Population matrix.
SelectionMethod
Enumeration of the available training operators for selection.
FitnessAssignmentMethod fitness_assignment_method
Fitness assignment training operators enumeration.
void randomize_population_uniform(void)
std::string write_selection_method(void) const
Returns a string with the name of the method used for selection.
size_t calculate_best_individual_index(void) const
Returns the index of the individual with greatest fitness.
bool reserve_mean_performance_history
True if the mean performance history vector is to be reserved, false otherwise.
const Vector< bool > & get_selection(void) const
Returns the actual selection value of all individuals in the population.
const bool & get_reserve_mean_norm_history(void) const
Returns true if the mean population norm history vector is to be reserved, and false otherwise...
const bool & get_reserve_generalization_performance_history(void) const
Returns true if the Generalization performance history vector is to be reserved, and false otherwise...
void set_maximum_time(const double &)
double recombination_size
void set_elitism_size(const size_t &)
void set_reserve_best_performance_history(const bool &)
const bool & get_reserve_mean_performance_history(void) const
Returns true if the mean performance history vector is to be reserved, and false otherwise.
Vector< double > elapsed_time_history
History of the elapsed time over the generations.
void perform_roulette_wheel_selection(void)
const size_t & get_maximum_generalization_performance_decreases(void) const
Returns the maximum number of generalization failures during the training process.
void set_mutation_rate(const double &)
RecombinationMethod recombination_method
Recombination training operators enumeration.
MutationMethod
Enumeration of the available training operators for mutation.
void set_reserve_standard_deviation_norm_history(const bool &)
void set_reserve_best_norm_history(const bool &)
double mean_performance_goal
double final_generalization_performance
Generalization performance after training.
EvolutionaryAlgorithmResults(EvolutionaryAlgorithm *new_evolutionary_algorithm_pointer)
Evolutionary algorithm constructor.
double error_parameters_norm
Value for the parameters norm at which the training process is assumed to fail.
void set_mean_performance_goal(const double &)
const Matrix< double > & get_population(void) const
Returns the population matrix.
RecombinationMethod
Enumeration of the available training operators for recombination.
const size_t & get_elitism_size(void) const
Returns the number of individuals which will always be selected for recombination.
Vector< Vector< double > > best_individual_history
History of the best individual parameters over the generations.
const Vector< double > & get_fitness(void) const
Returns the actual fitness value of all individuals in the population.
void perform_fitness_assignment(void)
Assigns a fitness value to all the individuals in the population according to the finess assignment o...
void set_best_performance_goal(const double &)