9#ifndef GENETICALGORITHM_H
10#define GENETICALGORITHM_H
25#include "training_strategy.h"
26#include "tensor_utilities.h"
27#include "inputs_selection.h"
63 const Tensor<bool, 1>& get_selection()
const;
66 Index get_genes_number()
const;
79 void set_training_errors(
const Tensor<type, 1>&);
80 void set_selection_errors(
const Tensor<type, 1>&);
124 void save(
const string&)
const;
125 void load(
const string&);
138 Tensor<bool, 1> selection;
144 Tensor<type, 1> training_errors;
145 Tensor<type, 1> selection_errors;
Tensor< bool, 2 > population
Population matrix.
void set_individuals_number(const Index &)
void set_fitness(const Tensor< type, 1 > &)
void from_XML(const tinyxml2::XMLDocument &)
void set_default()
Sets the members of the genetic algorithm object to their default values.
void set_elitism_size(const Index &)
Tensor< Tensor< type, 1 >, 1 > parameters
Performance of population.
void load(const string &)
virtual ~GeneticAlgorithm()
Destructor.
Tensor< string, 2 > to_string_matrix() const
InputsSelectionResults perform_inputs_selection()
Select the inputs with best generalization properties using the genetic algorithm.
void evaluate_population()
GeneticAlgorithm()
Default constructor.
const Index & get_elitism_size() const
Returns the size of the elite in the selection.
void perform_fitness_assignment()
Calculate the fitness with the errors depending on the fitness assignment method.
void perform_selection()
Selects for crossover some individuals from the population.
void perform_mutation()
Perform the mutation of the individuals generated in the crossover.
void save(const string &) const
Index get_individuals_number() const
Returns the size of the population.
void set_mutation_rate(const type &)
void write_XML(tinyxml2::XMLPrinter &) const
const type & get_mutation_rate() const
Returns the rate used in the mutation.
const Tensor< type, 1 > & get_fitness() const
Returns the fitness of the population.
const Tensor< bool, 2 > & get_population() const
Returns the population matrix.
Tensor< type, 1 > fitness
Fitness of population.
void set_population(const Tensor< bool, 2 > &)
void initialize_population()
Initialize the population depending on the intialization method.
void perform_crossover()
Perform the crossover depending on the crossover method.
This class represents the concept of training strategy for a neural network in OpenNN.