OpenNN  2.2
Open Neural Networks Library
Classes | Public Types | Public Member Functions | Private Attributes | List of all members
OpenNN::EvolutionaryAlgorithm Class Reference

#include <evolutionary_algorithm.h>

Inheritance diagram for OpenNN::EvolutionaryAlgorithm:
OpenNN::TrainingAlgorithm

Classes

struct  EvolutionaryAlgorithmResults
 

Public Types

enum  FitnessAssignmentMethod { LinearRanking }
 
enum  SelectionMethod { RouletteWheel }
 
enum  RecombinationMethod { Line, Intermediate }
 
enum  MutationMethod { Normal, Uniform }
 

Public Member Functions

 EvolutionaryAlgorithm (void)
 
 EvolutionaryAlgorithm (PerformanceFunctional *)
 
 EvolutionaryAlgorithm (const tinyxml2::XMLDocument &)
 
virtual ~EvolutionaryAlgorithm (void)
 
const double & get_warning_parameters_norm (void) const
 
const double & get_error_parameters_norm (void) const
 
const double & get_best_performance_goal (void) const
 
const size_t & get_maximum_generalization_performance_decreases (void) const
 
const size_t & get_maximum_generations_number (void) const
 
const double & get_maximum_time (void) const
 
const bool & get_reserve_generalization_performance_history (void) const
 
const bool & get_reserve_elapsed_time_history (void) const
 
size_t get_population_size (void) const
 
const Matrix< double > & get_population (void) const
 
const FitnessAssignmentMethodget_fitness_assignment_method (void) const
 
std::string write_fitness_assignment_method (void) const
 
const SelectionMethodget_selection_method (void) const
 
std::string write_selection_method (void) const
 
const RecombinationMethodget_recombination_method (void) const
 
std::string write_recombination_method (void) const
 
const MutationMethodget_mutation_method (void) const
 
std::string write_mutation_method (void) const
 
const Vector< double > & get_performance (void) const
 
const Vector< double > & get_fitness (void) const
 
const Vector< bool > & get_selection (void) const
 
const size_t & get_elitism_size (void) const
 
const double & get_selective_pressure (void) const
 
const double & get_recombination_size (void) const
 
const double & get_mutation_rate (void) const
 
const double & get_mutation_range (void) const
 
const double & get_mean_performance_goal (void) const
 
const double & get_standard_deviation_performance_goal (void) const
 
const bool & get_reserve_population_history (void) const
 
const bool & get_reserve_best_individual_history (void) const
 
const bool & get_reserve_mean_norm_history (void) const
 
const bool & get_reserve_standard_deviation_norm_history (void) const
 
const bool & get_reserve_best_norm_history (void) const
 
const bool & get_reserve_mean_performance_history (void) const
 
const bool & get_reserve_standard_deviation_performance_history (void) const
 
const bool & get_reserve_best_performance_history (void) const
 
void set (void)
 
void set (PerformanceFunctional *)
 
void set_default (void)
 
void set_fitness_assignment_method (const FitnessAssignmentMethod &)
 
void set_fitness_assignment_method (const std::string &)
 
void set_selection_method (const SelectionMethod &)
 
void set_selection_method (const std::string &)
 
void set_recombination_method (const RecombinationMethod &)
 
void set_recombination_method (const std::string &)
 
void set_mutation_method (const MutationMethod &)
 
void set_mutation_method (const std::string &)
 
void set_population_size (const size_t &)
 
void set_population (const Matrix< double > &)
 
void set_performance (const Vector< double > &)
 
void set_fitness (const Vector< double > &)
 
void set_selection (const Vector< bool > &)
 
void set_elitism_size (const size_t &)
 
void set_selective_pressure (const double &)
 
void set_recombination_size (const double &)
 
void set_mutation_rate (const double &)
 
void set_mutation_range (const double &)
 
void set_maximum_generations_number (const size_t &)
 
void set_mean_performance_goal (const double &)
 
void set_standard_deviation_performance_goal (const double &)
 
void set_reserve_population_history (const bool &)
 
void set_reserve_best_individual_history (const bool &)
 
void set_reserve_mean_norm_history (const bool &)
 
void set_reserve_standard_deviation_norm_history (const bool &)
 
void set_reserve_best_norm_history (const bool &)
 
void set_reserve_mean_performance_history (const bool &)
 
void set_reserve_standard_deviation_performance_history (const bool &)
 
void set_reserve_best_performance_history (const bool &)
 
void set_reserve_all_training_history (const bool &)
 
void set_warning_parameters_norm (const double &)
 
void set_error_parameters_norm (const double &)
 
void set_best_performance_goal (const double &)
 
void set_maximum_generalization_performance_decreases (const size_t &)
 
void set_maximum_time (const double &)
 
void set_reserve_generalization_performance_history (const bool &)
 
void set_reserve_elapsed_time_history (const bool &)
 
void set_display_period (const size_t &)
 
Vector< double > get_individual (const size_t &) const
 
void set_individual (const size_t &, const Vector< double > &)
 
size_t calculate_best_individual_index (void) const
 
double calculate_mean_performance (void) const
 
double calculate_standard_deviation_performance (void) const
 
void initialize_population (const double &)
 
void randomize_population_uniform (void)
 
void randomize_population_uniform (const double &, const double &)
 
void randomize_population_uniform (const Vector< double > &, const Vector< double > &)
 
void randomize_population_normal (void)
 
void randomize_population_normal (const double &, const double &)
 
void randomize_population_normal (const Vector< double > &, const Vector< double > &)
 
Vector< double > calculate_population_norm (void) const
 
void perform_fitness_assignment (void)
 
void perform_selection (void)
 
void perform_recombination (void)
 
void perform_mutation (void)
 
void evolve_population (void)
 
void evaluate_population (void)
 
void perform_linear_ranking_fitness_assignment (void)
 
void perform_roulette_wheel_selection (void)
 
void perform_intermediate_recombination (void)
 
void perform_line_recombination (void)
 
void perform_normal_mutation (void)
 
void perform_uniform_mutation (void)
 
EvolutionaryAlgorithmResultsperform_training (void)
 
std::string write_training_algorithm_type (void) const
 
Matrix< std::string > to_string_matrix (void) const
 
tinyxml2::XMLDocument * to_XML (void) const
 
void from_XML (const tinyxml2::XMLDocument &)
 
void initialize_random (void)
 
- Public Member Functions inherited from OpenNN::TrainingAlgorithm
 TrainingAlgorithm (void)
 
 TrainingAlgorithm (PerformanceFunctional *)
 
 TrainingAlgorithm (const tinyxml2::XMLDocument &)
 
virtual ~TrainingAlgorithm (void)
 
virtual TrainingAlgorithmoperator= (const TrainingAlgorithm &)
 
virtual bool operator== (const TrainingAlgorithm &) const
 
PerformanceFunctionalget_performance_functional_pointer (void) const
 
bool has_performance_functional (void) const
 
const bool & get_display (void) const
 
const size_t & get_display_period (void) const
 
const size_t & get_save_period (void) const
 
const std::string & get_neural_network_file_name (void) const
 
void set (void)
 
void set (PerformanceFunctional *)
 
virtual void set_performance_functional_pointer (PerformanceFunctional *)
 
void set_display (const bool &)
 
void set_display_period (const size_t &)
 
void set_save_period (const size_t &)
 
void set_neural_network_file_name (const std::string &)
 
virtual void check (void) const
 
virtual std::string to_string (void) const
 
void print (void) const
 
void save (const std::string &) const
 
void load (const std::string &)
 

Private Attributes

Matrix< double > population
 
Vector< double > performance
 
Vector< double > fitness
 
Vector< bool > selection
 
FitnessAssignmentMethod fitness_assignment_method
 
SelectionMethod selection_method
 
RecombinationMethod recombination_method
 
MutationMethod mutation_method
 
size_t elitism_size
 
double selective_pressure
 
double recombination_size
 
double mutation_rate
 
double mutation_range
 
double warning_parameters_norm
 
double error_parameters_norm
 
double mean_performance_goal
 
double standard_deviation_performance_goal
 
double best_performance_goal
 
size_t maximum_generations_number
 
size_t maximum_generalization_performance_decreases
 
double maximum_time
 
bool reserve_population_history
 
bool reserve_best_individual_history
 
bool reserve_mean_norm_history
 
bool reserve_standard_deviation_norm_history
 
bool reserve_best_norm_history
 
bool reserve_mean_performance_history
 
bool reserve_standard_deviation_performance_history
 
bool reserve_best_performance_history
 
bool reserve_elapsed_time_history
 
bool reserve_generalization_performance_history
 

Additional Inherited Members

- Protected Attributes inherited from OpenNN::TrainingAlgorithm
PerformanceFunctionalperformance_functional_pointer
 
size_t display_period
 
size_t save_period
 
std::string neural_network_file_name
 
bool display
 

Detailed Description

This concrete class represents an evolutionary training algorithm for a performance functional of a neural network.

Definition at line 40 of file evolutionary_algorithm.h.

Constructor & Destructor Documentation

OpenNN::EvolutionaryAlgorithm::EvolutionaryAlgorithm ( void  )
explicit

Default constructor. It creates a evolutionary training algorithm not associated to any performance functional. It also initializes the class members to their default values.

Definition at line 27 of file evolutionary_algorithm.cpp.

OpenNN::EvolutionaryAlgorithm::EvolutionaryAlgorithm ( PerformanceFunctional new_performance_functional_pointer)
explicit

Performance functional constructor. It creates a evolutionary training algorithm associated to a performance functional. It also initializes the class members to their default values.

Parameters
new_performance_functional_pointerPointer to a performance functional object.

Definition at line 40 of file evolutionary_algorithm.cpp.

OpenNN::EvolutionaryAlgorithm::EvolutionaryAlgorithm ( const tinyxml2::XMLDocument &  evolutionary_algorithm_document)
explicit

XML constructor. It creates a evolutionary training algorithm not associated to any performance functional. It also loads the class members from a XML document.

Parameters
evolutionary_algorithm_documentTinyXML document with the evolutionary algorithm object members.

Definition at line 54 of file evolutionary_algorithm.cpp.

Member Function Documentation

void OpenNN::EvolutionaryAlgorithm::evaluate_population ( void  )

Evaluates the performance functional of all individuals in the population. Results are stored in the performance vector.

Definition at line 2064 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::from_XML ( const tinyxml2::XMLDocument &  document)
virtual

Loads a evolutionary algorithm object from a XML document. Please mind about the file format, wich is specified in the User's Guide.

Parameters
documentTinyXML document with the evolutionary algorithm object members.

Reimplemented from OpenNN::TrainingAlgorithm.

Definition at line 3678 of file evolutionary_algorithm.cpp.

const double & OpenNN::EvolutionaryAlgorithm::get_best_performance_goal ( void  ) const

Returns the goal value for the performance. This is used as a stopping criterion when training a multilayer perceptron

Definition at line 317 of file evolutionary_algorithm.cpp.

const double & OpenNN::EvolutionaryAlgorithm::get_error_parameters_norm ( void  ) const

Returns the value for the norm of the parameters vector at wich an error message is written to the screen and the program exits.

Definition at line 306 of file evolutionary_algorithm.cpp.

Vector< double > OpenNN::EvolutionaryAlgorithm::get_individual ( const size_t &  i) const

Returns the Vector of parameters corresponding to the individual i in the population.

Parameters
iIndex of individual in the population.

Definition at line 1086 of file evolutionary_algorithm.cpp.

const bool & OpenNN::EvolutionaryAlgorithm::get_reserve_best_norm_history ( void  ) const

Returns true if the norm of the best individual in the population history vector is to be reserved, and false otherwise.

Definition at line 409 of file evolutionary_algorithm.cpp.

const bool & OpenNN::EvolutionaryAlgorithm::get_reserve_standard_deviation_norm_history ( void  ) const

Returns true if the standard deviation of the population norm history vector is to be reserved, and false otherwise.

Definition at line 398 of file evolutionary_algorithm.cpp.

const bool & OpenNN::EvolutionaryAlgorithm::get_reserve_standard_deviation_performance_history ( void  ) const

Returns true if the standard deviation of the performance history vector is to be reserved, and false otherwise.

Definition at line 430 of file evolutionary_algorithm.cpp.

const double & OpenNN::EvolutionaryAlgorithm::get_warning_parameters_norm ( void  ) const

Returns the minimum value for the norm of the parameters vector at wich a warning message is written to the screen.

Definition at line 295 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::initialize_population ( const double &  new_value)

Initializes the population matrix with a given value.

Parameters
new_valueInitialization value.

Definition at line 1733 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::initialize_random ( void  )
virtual

Default random initialization for a training algorithm object. It just sets a random display value.

Reimplemented from OpenNN::TrainingAlgorithm.

Definition at line 4084 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::perform_intermediate_recombination ( void  )

Performs inediate 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 2259 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::perform_line_recombination ( void  )

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 2387 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::perform_linear_ranking_fitness_assignment ( void  )

Ranks all individuals in the population by their performance, 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. The smallest fitness corresponds to the smallest performance, and the greatest fitness to the greatest performance. Results are stored in the fitness vector.

Definition at line 2141 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::perform_normal_mutation ( void  )

Performs normal mutation to all individuals in order to generate a new population. Results are stored in the population matrix.

Definition at line 2512 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::perform_roulette_wheel_selection ( 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 2165 of file evolutionary_algorithm.cpp.

EvolutionaryAlgorithm::EvolutionaryAlgorithmResults * OpenNN::EvolutionaryAlgorithm::perform_training ( void  )
virtual

Trains a neural network with an associated performance function according to the evolutionary algorithm. Training occurs according to the training operators and their related parameters.

Implements OpenNN::TrainingAlgorithm.

Definition at line 2866 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::perform_uniform_mutation ( void  )

Performs uniform mutation to all individuals in order to generate a new population. Results are stored in the population matrix.

Definition at line 2550 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::randomize_population_normal ( void  )

Initializes the parameters of all the individuals in the population with random values chosen from a normal distribution with mean 0 and standard deviation 1.

Definition at line 1817 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::randomize_population_normal ( const double &  mean,
const double &  standard_deviation 
)

Initializes the parameters of all the individuals in the population with random values chosen from a normal distribution with a given mean and a given standard deviation.

Parameters
meanMean of normal distribution.
standard_deviationStandard deviation of normal distribution.

Definition at line 1831 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::randomize_population_normal ( const Vector< double > &  mean,
const Vector< double > &  standard_deviation 
)

Initializes the parameters of all the individuals in the population with random values chosen from normal distributions with different mean and standard deviation for each free parameter.

Parameters
meanVector of mean values.
standard_deviationVector of standard deviation values.

Definition at line 1846 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::randomize_population_uniform ( void  )

Initializes the parameters of all the individuals in the population at random, with values comprised between -1 and 1.

Definition at line 1745 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::randomize_population_uniform ( const double &  minimum,
const double &  maximum 
)

Initializes the parameters of all the individuals in the population at random, with values comprised between a minimum and a maximum value.

Parameters
minimumMinimum initialization value.
maximumMaximum initialization value.

Definition at line 1759 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::randomize_population_uniform ( const Vector< double > &  minimum,
const Vector< double > &  maximum 
)

Initializes the parameters of all the individuals in the population at random, with values comprised between different minimum and maximum values for each variable.

Parameters
minimumVector of minimum initialization values.
maximumVector of maximum initialization values.

Definition at line 1773 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set ( void  )

Sets the performance functional pointer of this object to NULL. It also sets the rest of members to their default values.

Definition at line 451 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set ( PerformanceFunctional new_performance_functional_pointer)

Sets a new performance functional pointer to the evolutionary algorithm object. It also sets the rest of members to their default values.

Definition at line 464 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_best_performance_goal ( const double &  new_best_performance_goal)

Sets a new goal value for the performance. This is used as a stopping criterion when training a multilayer perceptron.

Parameters
new_best_performance_goalGoal value for the performance.

Definition at line 1243 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_default ( void  )
virtual

Sets the members of the evolutionary algorithm object to their default values. Training operators:

  • Fitness assignment method: Linear ranking.
  • Selection method: Roulette wheel.
  • Recombination method: Intermediate.
  • Mutation method: Normal.

Training parameters:

  • Population size: 10*parameters_number or 0.
  • Perform elitism: false.
  • Selective pressure: 1.5.
  • Recombination size: 0.25.
  • Mutation rate: = 1/parameters_number or 0.
  • Mutation range: = 0.1

Stopping criteria:

  • Performance goal: -1.0e99.
  • Mean performance goal: -1.0e99.
  • Standard deviation of performance goal: -1.0e99.
  • Maximum training time: 1.0e6.
  • Maximum number of generations: 100.

Training history:

  • Population = false.
  • Mean norm = false.
  • Standard deviation norm = false.
  • Best norm = false.
  • Mean performance = false.
  • Standard deviation performance = false.
  • Best performance = false.

User stuff:

  • Display: true.
  • Display period: 1.

Reimplemented from OpenNN::TrainingAlgorithm.

Definition at line 515 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_display_period ( const size_t &  new_display_period)

Sets a new number of iterations between the training showing progress.

Parameters
new_display_periodNumber of iterations between the training showing progress.

Definition at line 1320 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_elitism_size ( const size_t &  new_elitism_size)

Sets a new elitism size to the evolutionary algorithm. The elitism size is the number of individuals which will always be selected for recombination.

Parameters
new_elitism_sizeElitism size to be set.

Definition at line 1479 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_error_parameters_norm ( const double &  new_error_parameters_norm)

Sets a new value for the parameters vector norm at which an error message is written to the screen and the program exits.

Parameters
new_error_parameters_normError norm of parameters vector value.

Definition at line 1212 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_fitness ( const Vector< double > &  new_fitness)

Sets a new population fitness vector.

Parameters
new_fitnessPopulation fitness values.

Definition at line 887 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_fitness_assignment_method ( const FitnessAssignmentMethod new_fitness_assignment_method)

Sets a new fitness assignment method to be used for training.

Parameters
new_fitness_assignment_methodFitness assignment method chosen for training.

Definition at line 1684 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_fitness_assignment_method ( const std::string &  new_fitness_assignment_method_name)

Sets a new method for fitness assignment from a string containing the name. Possible values are:

  • "LinearRanking"
Parameters
new_fitness_assignment_method_nameString with name of method for fitness assignment.

Definition at line 681 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_individual ( const size_t &  i,
const Vector< double > &  individual 
)

Sets a new Vector of parameters to the individual i in the population.

Parameters
iIndex of individual in the population.
individualVector of parameters to be assigned to individual i.

Definition at line 1122 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_maximum_generalization_performance_decreases ( const size_t &  new_maximum_generalization_performance_decreases)

Sets a new maximum number of generalization failures.

Parameters
new_maximum_generalization_performance_decreasesMaximum number of iterations in which the generalization evalutation decreases.

Definition at line 1254 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_maximum_generations_number ( const size_t &  new_maximum_generations_number)

Sets a new value for the maximum number of generations to perform_training. The maximum number of generations value must be a positive number.

Parameters
new_maximum_generations_numberMaximum number of generations value.

Definition at line 1611 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_maximum_time ( const double &  new_maximum_time)

Sets a new maximum training time.

Parameters
new_maximum_timeMaximum training time.

Definition at line 1265 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_mean_performance_goal ( const double &  new_mean_performance_goal)

Sets a new value for the mean performance goal stopping criterion.

Parameters
new_mean_performance_goalGoal value for the mean performance of the population.

Definition at line 1642 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_mutation_method ( const MutationMethod new_mutation_method)

Sets a new mutation method to be used for training.

Parameters
new_mutation_methodMutation method chosen for training.

Definition at line 1722 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_mutation_method ( const std::string &  new_mutation_method_name)

Sets a new method for mutation from a string containing the name. Possible values are:

  • "Normal"
  • "Uniform"
Parameters
new_mutation_method_nameString with name of method for mutation.

Definition at line 771 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_mutation_range ( const double &  new_mutation_range)

Sets a new value for the mutation range parameter. The mutation range value must be 0 or a positive number.

Parameters
new_mutation_rangeMutation range value. This must be equal or greater than 0.

Definition at line 1584 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_mutation_rate ( const double &  new_mutation_rate)

Sets a new value for the mutation rate parameter. The mutation rate value must be between 0 and 1.

Parameters
new_mutation_rateMutation rate value. This value must lie in the interval [0,1].

Definition at line 1556 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_performance ( const Vector< double > &  new_performance)

Sets a new population performance vector.

Parameters
new_performancePopulation performance values.

Definition at line 854 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_population ( const Matrix< double > &  new_population)

Sets a new population.

Parameters
new_populationPopulation Matrix.

Definition at line 800 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_population_size ( const size_t &  new_population_size)

Sets a new population with a new number of individuals. The new population size must be an even number equal or greater than four.

Parameters
new_population_sizeNumber of individuals in the population. This must be an even number equal or greater than four.

Definition at line 585 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_recombination_method ( const RecombinationMethod new_recombination_method)

Sets a new recombination method to be used for training.

Parameters
new_recombination_methodRecombination method chosen for training.

Definition at line 1710 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_recombination_method ( const std::string &  new_recombination_method_name)

Sets a new method for recombination from a string containing the name. Possible values are:

  • "Line"
  • "Intermediate"
Parameters
new_recombination_method_nameString with name of method for recombination.

Definition at line 738 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_recombination_size ( const double &  new_recombination_size)

Sets a new value for the recombination size parameter. The recombination size value must be equal or greater than 0.

Parameters
new_recombination_sizeRecombination size value. This must be equal or greater than 0.

Definition at line 1530 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_reserve_all_training_history ( const bool &  new_reserve_all_training_history)

Makes the training history of all variables to reseved or not in memory.

Parameters
new_reserve_all_training_historyTrue if the training history of all variables is to be reserved, false otherwise.

Definition at line 1056 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_reserve_best_individual_history ( const bool &  new_reserve_best_individual_history)

Makes the best individual history vector of vectors to be reseved or not in memory.

Parameters
new_reserve_best_individual_historyTrue if the best individual history vector of vectors is to be reserved, false otherwise.

Definition at line 965 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_reserve_best_norm_history ( const bool &  new_reserve_best_norm_history)

Makes the best norm history vector to be reseved or not in memory.

Parameters
new_reserve_best_norm_historyTrue if the best norm history vector is to be reserved, false otherwise.

Definition at line 1003 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_reserve_best_performance_history ( const bool &  new_reserve_best_performance_history)

Makes the best performance history vector to be reseved or not in memory.

Parameters
new_reserve_best_performance_historyTrue if the best performance history vector is to be reserved, false otherwise.

Definition at line 1043 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_reserve_elapsed_time_history ( const bool &  new_reserve_elapsed_time_history)

Makes the elapsed time over the iterations to be reseved or not in memory. This is a vector.

Parameters
new_reserve_elapsed_time_historyTrue if the elapsed time history vector is to be reserved, false otherwise.

Definition at line 1296 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_reserve_generalization_performance_history ( const bool &  new_reserve_generalization_performance_history)

Makes the Generalization performance history to be reserved or not in memory. This is a vector.

Parameters
new_reserve_generalization_performance_historyTrue if the Generalization performance history is to be reserved, false otherwise.

Definition at line 1308 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_reserve_mean_norm_history ( const bool &  new_reserve_mean_norm_history)

Makes the mean norm history vector to be reseved or not in memory.

Parameters
new_reserve_mean_norm_historyTrue if the mean norm history vector is to be reserved, false otherwise.

Definition at line 977 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_reserve_mean_performance_history ( const bool &  new_reserve_mean_performance_history)

Makes the mean performance history vector to be reseved or not in memory.

Parameters
new_reserve_mean_performance_historyTrue if the mean performance history vector is to be reserved, false otherwise.

Definition at line 1016 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_reserve_population_history ( const bool &  new_reserve_population_history)

Makes the population history vector of matrices to be reseved or not in memory.

Parameters
new_reserve_population_historyTrue if the population history vector of matrices is to be reserved, false otherwise.

Definition at line 953 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_reserve_standard_deviation_norm_history ( const bool &  new_reserve_standard_deviation_norm_history)

Makes the standard deviation norm history vector to be reseved or not in memory.

Parameters
new_reserve_standard_deviation_norm_historyTrue if the standard deviation norm history vector is to be reserved, false otherwise.

Definition at line 991 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_reserve_standard_deviation_performance_history ( const bool &  new_reserve_standard_deviation_performance_history)

Makes the standard deviation performance history vector to be reseved or not in memory.

Parameters
new_reserve_standard_deviation_performance_historyTrue if the standard deviation performance history vector is to be reserved, false otherwise.

Definition at line 1030 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_selection ( const Vector< bool > &  new_selection)

Sets a new population selection vector.

Parameters
new_selectionPopulation selection values.

Definition at line 920 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_selection_method ( const SelectionMethod new_selection_method)

Sets a new selection method to be used for training.

Parameters
new_selection_methodSelection method chosen for training.

Definition at line 1697 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_selection_method ( const std::string &  new_selection_method_name)

Sets a new method for selection from a string containing the name. Possible values are:

  • "LinearRanking"
Parameters
new_selection_method_nameString with name of method for selection.

Definition at line 709 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_selective_pressure ( const double &  new_selective_pressure)

Sets a new value for the selective pressure parameter. Linear ranking allows values for the selective pressure greater than 0.

Parameters
new_selective_pressureSelective pressure value.

Definition at line 1504 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_standard_deviation_performance_goal ( const double &  new_standard_deviation_performance_goal)

Sets a new value for the standard deviation performance goal stopping criterion.

Parameters
new_standard_deviation_performance_goalGoal for the standard deviation performance of the population.

Definition at line 1653 of file evolutionary_algorithm.cpp.

void OpenNN::EvolutionaryAlgorithm::set_warning_parameters_norm ( const double &  new_warning_parameters_norm)

Sets a new value for the parameters vector norm at which a warning message is written to the screen.

Parameters
new_warning_parameters_normWarning norm of parameters vector value.

Definition at line 1181 of file evolutionary_algorithm.cpp.

Matrix< std::string > OpenNN::EvolutionaryAlgorithm::to_string_matrix ( void  ) const
virtual

Returns a default (empty) string matrix containing the members of the training algorithm object.

Reimplemented from OpenNN::TrainingAlgorithm.

Definition at line 3221 of file evolutionary_algorithm.cpp.

tinyxml2::XMLDocument * OpenNN::EvolutionaryAlgorithm::to_XML ( void  ) const
virtual

Prints to the screen the members of the evolutionary algorithm object.

Training operators:

  • Fitness assignment method.
  • Selection method.
  • Recombination method.
  • Mutation method.

Training parameters:

  • Population size.
  • Selective pressure.
  • Recombination size.
  • Mutation rate.
  • Mutation range.

Stopping criteria:

  • Performance goal.
  • Mean performance goal.
  • Standard deviation of performance goal.
  • Maximum time.
  • Maximum number of generations.

User stuff:

  • Display.
  • Display period.
  • Reserve elapsed time.
  • Reserve mean norm history.
  • Reserve standard deviation of norm history.
  • Reserve best norm history.
  • Reserve mean performance history.
  • Reserve standard deviation of performance history.
  • Reserve best performance history.

Population matrix.

Reimplemented from OpenNN::TrainingAlgorithm.

Definition at line 3413 of file evolutionary_algorithm.cpp.

Member Data Documentation

size_t OpenNN::EvolutionaryAlgorithm::elitism_size
private

Elitism size. It represents the number of individuals which will always be selected for recombination. This is a parameter of the selection operator.

Definition at line 461 of file evolutionary_algorithm.h.

size_t OpenNN::EvolutionaryAlgorithm::maximum_generalization_performance_decreases
private

Number of generations where the generalization performance decreases. This is an early stopping method for improving generalization.

Definition at line 519 of file evolutionary_algorithm.h.

double OpenNN::EvolutionaryAlgorithm::mean_performance_goal
private

Target value for the mean performance of the population. It is used as a stopping criterion.

Definition at line 501 of file evolutionary_algorithm.h.

double OpenNN::EvolutionaryAlgorithm::mutation_range
private

Mutation range. The mutation range value must be 0 or a positive number. This is a parameter of the mutation operator.

Definition at line 485 of file evolutionary_algorithm.h.

double OpenNN::EvolutionaryAlgorithm::mutation_rate
private

Mutation rate. The mutation rate value must be between 0 and 1. This is a parameter of the mutation operator.

Definition at line 479 of file evolutionary_algorithm.h.

double OpenNN::EvolutionaryAlgorithm::recombination_size
private

Recombination size. The recombination size value must be equal or greater than 0. This is a parameter of the recombination operator.

Definition at line 473 of file evolutionary_algorithm.h.

bool OpenNN::EvolutionaryAlgorithm::reserve_best_individual_history
private

True if the history of the best individual ever is to be reserved, and false otherwise. The best individual history is a vector of vectors.

Definition at line 536 of file evolutionary_algorithm.h.

bool OpenNN::EvolutionaryAlgorithm::reserve_population_history
private

True if the population history, which is a vector of matrices, is to be reserved, false otherwise. Reserving the population history can be compuationally expensive if the number of parameters, the population size and the number of generations are big numbers.

Definition at line 531 of file evolutionary_algorithm.h.

double OpenNN::EvolutionaryAlgorithm::selective_pressure
private

Selective pressure. Linear ranking allows values for the selective pressure greater than 0. This is a parameter of the selection operator.

Definition at line 467 of file evolutionary_algorithm.h.

double OpenNN::EvolutionaryAlgorithm::standard_deviation_performance_goal
private

Target value for the standard deviation of the population performance. It is used as a stopping criterion.

Definition at line 506 of file evolutionary_algorithm.h.


The documentation for this class was generated from the following files: