Fido
 All Classes Namespaces Files Functions Variables Typedefs Macros Pages
Public Member Functions | List of all members
gen::GeneticAlgo Class Reference

Genetic algorithms used to produce fit neural networks. More...

#include <GeneticAlgo.h>

Public Member Functions

 GeneticAlgo (unsigned int populationSize_, float mutationRate_, float crossoverRate_, int numberOfElitismCopies_, std::vector< double >(*getPopulationFitness_)(const std::vector< net::NeuralNet > &neuralNet))
 Initializes a genetic algorithm with the necessary parameters. More...
 
net::NeuralNet getBestNeuralNetwork (int numberOfGenerations, net::NeuralNet modelNetwork)
 Returns the most fit neural network in a population that undergoes a specified number of generations. More...
 

Detailed Description

Genetic algorithms used to produce fit neural networks.

Constructor & Destructor Documentation

GeneticAlgo::GeneticAlgo ( unsigned int  populationSize_,
float  mutationRate_,
float  crossoverRate_,
int  numberOfElitismCopies_,
std::vector< double >(*)(const std::vector< net::NeuralNet > &neuralNet)  getPopulationFitness_ 
)

Initializes a genetic algorithm with the necessary parameters.

Parameters
populationSize_the number of neural networks in the population for each generation
mutationRate_the chance between 0 and 1 that a weight in a neural network will be mutated
crossoverRate_the chance between 0 and 1 that a couple will produce offspring having a fused verion of their parents' networks, instead of offspring that have the same neural networks as their parents; if set to 0, the population's composition will only change as a result of mutations.
numberOfElitismCopies_the number of times that best neural network from the past generation shows up in the current generation
getPopulationFitness_a function that returns a vector of doubles housing the fitness of every individual in the population, when given the population of neural networks

Member Function Documentation

net::NeuralNet GeneticAlgo::getBestNeuralNetwork ( int  numberOfGenerations,
net::NeuralNet  modelNetwork 
)

Returns the most fit neural network in a population that undergoes a specified number of generations.

Parameters
numberOfGenerationsthe number of generations that the simulation will run for; in each generation, fitnesses are assigned, mating occurs, and offspring are added
modelNetworkused to determine the architecuture of the neural networks in the population,.

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