Unfit  3.1.1
Data fitting and optimization software
Public Member Functions | List of all members
Unfit::TestGeneticAlgorithm Class Reference
Inheritance diagram for Unfit::TestGeneticAlgorithm:
Unfit::GeneticAlgorithm Unfit::GenericOptimizer

Public Member Functions

void AccessGeneratePopulation (GenericCostFunction &CostFunction)
 
std::pair< unsigned, unsigned > AccessGetMatingPair ()
 
void AccessReproduce (GenericCostFunction &CostFunction)
 
void AccessCrossOver (const std::vector< double > &parent_1, const std::vector< double > &parent_2, std::vector< double > &offspring_1, std::vector< double > &offspring_2)
 
void AccessInitialiseBounds ()
 
void AccessGeneratorSeed (unsigned seed)
 
double AccessDistributionsGenerator (unsigned i)
 
std::vector< std::vector< double > > AccessPopulation () const
 
void AccessMutateGenes (GenericCostFunction &CostFunction)
 
void SetDimensions (unsigned dimensions)
 
std::vector< double > AccessRanks ()
 
bool AssignPopulation (GenericCostFunction &CostFunction, const std::vector< std::vector< double >> &chromosomes)
 
- Public Member Functions inherited from Unfit::GeneticAlgorithm
 GeneticAlgorithm ()
 
virtual ~GeneticAlgorithm ()
 
int FindMin (GenericCostFunction &CostFunction, std::vector< double > &coordinates) override
 A method to find a minimum point of a function using a Genetic Algorithm approach. More...
 
void Reset () override
 
- Public Member Functions inherited from Unfit::GenericOptimizer
 GenericOptimizer ()
 
virtual ~GenericOptimizer ()
 
void ResetGenericOptimizer ()
 
virtual double GetCost (std::size_t index=0) const noexcept
 
virtual bool GetIsPopulationBased () const noexcept
 
virtual std::size_t GetNumberOfIterations () const noexcept
 
virtual std::size_t GetNumberOfFunctionEvaluations () const noexcept
 
virtual std::vector< std::vector< double > > GetPopulation () const
 
virtual std::vector< double > GetSolution (std::size_t index=0) const
 
virtual void SetPopulation (const std::vector< std::vector< double >> &population)
 

Additional Inherited Members

- Public Attributes inherited from Unfit::GenericOptimizer
Unfit::Bounds bounds
 
Unfit::Options options
 
- Protected Member Functions inherited from Unfit::GenericOptimizer
virtual bool CalculateCost (GenericCostFunction &CostFunction, std::vector< double > &x)
 
void GeneratePopulation (GenericCostFunction &CostFunction, std::size_t dimensions)
 
void GenerateRandomEngines ()
 
virtual bool IsConverged (const std::vector< double > &best_member, std::size_t truncated_index=0) const
 Checks to see if the population has converged. More...
 
virtual void PrintInitialOutput (double best_cost) const
 
virtual void PrintIterationOutput (double best_cost) const
 
virtual void PrintFinalOutput () const
 
virtual void SortPopulation () noexcept
 
- Protected Attributes inherited from Unfit::GenericOptimizer
std::vector< std::vector< double > > population_
 
std::vector< std::mt19937 > random_engines_
 
std::atomic< std::size_t > function_evaluations_
 
std::atomic< std::size_t > iterations_
 
bool is_population_based_
 

Detailed Description

This class is designed solely to provide the functionality to access the private methods and member variables of the GeneticAlgorithm class.

Member Function Documentation

◆ AccessCrossOver()

void Unfit::TestGeneticAlgorithm::AccessCrossOver ( const std::vector< double > &  parent_1,
const std::vector< double > &  parent_2,
std::vector< double > &  offspring_1,
std::vector< double > &  offspring_2 
)
inline

A function to access the private method (CrossOver) in the GeneticAlgorithm class.

Parameters
parent_1The first parent of the mating pair
parent_2The second parent of the mating pair
offspring_1The first offspring from the mating pair
offspring_2The second offspring from the mating pair

◆ AccessDistributionsGenerator()

double Unfit::TestGeneticAlgorithm::AccessDistributionsGenerator ( unsigned  i)
inline

A function to access the private random number generation method in the GeneticAlgorithm class.

Parameters
iThe index of the cost function parameter
Returns
A bounded random number for the requested cost function parameter

◆ AccessGeneratePopulation()

void Unfit::TestGeneticAlgorithm::AccessGeneratePopulation ( GenericCostFunction CostFunction)
inline

A function to access the private method (GeneratePopulation) in the GeneticAlgorithm class.

Parameters
CostFunctionThe equation to be used to calculate the cost

◆ AccessGeneratorSeed()

void Unfit::TestGeneticAlgorithm::AccessGeneratorSeed ( unsigned  seed)
inline

A function to access the private random number generator method in the GeneticAlgorithm class and change its seed.

Parameters
seedThe new seed

◆ AccessGetMatingPair()

std::pair<unsigned, unsigned> Unfit::TestGeneticAlgorithm::AccessGetMatingPair ( )
inline

A function to access the private method (GetMatingPairs) in the GeneticAlgorithm class.

Returns
A pair for mating

◆ AccessInitialiseBounds()

void Unfit::TestGeneticAlgorithm::AccessInitialiseBounds ( )
inline

A function to access the private method (InitialiseBounds) in the GeneticAlgorithm class.

◆ AccessMutateGenes()

void Unfit::TestGeneticAlgorithm::AccessMutateGenes ( GenericCostFunction CostFunction)
inline

A function to access the private method (MutateGenes) in the GeneticAlgorithm class.

Parameters
CostFunctionThe function to calculate the cost of a chromosome

◆ AccessPopulation()

std::vector<std::vector<double> > Unfit::TestGeneticAlgorithm::AccessPopulation ( ) const
inline

A function to access the private vector (population) in the GeneticAlgorithm class.

Returns
The population of chromosomes (including the appended costs)

◆ AccessRanks()

std::vector<double> Unfit::TestGeneticAlgorithm::AccessRanks ( )
inline

A function to access the private variable (ranks_) in the GeneticAlgorithm class.

Returns
A vector containing the rank coefficients

◆ AccessReproduce()

void Unfit::TestGeneticAlgorithm::AccessReproduce ( GenericCostFunction CostFunction)
inline

A function to access the private method (Reproduce) in the GeneticAlgorithm class.

Parameters
CostFunctionThe equation to be used to calculate the cost

◆ AssignPopulation()

bool Unfit::TestGeneticAlgorithm::AssignPopulation ( GenericCostFunction CostFunction,
const std::vector< std::vector< double >> &  chromosomes 
)
inline

A function to set a whole population; for testing purposes only.

Parameters
CostFunctionReturns the residuals of the model
chromosomesThe intended population
Returns
true if the provided population is useable, false otherwise

◆ SetDimensions()

void Unfit::TestGeneticAlgorithm::SetDimensions ( unsigned  dimensions)
inline

A function to set the private variable (dimensions_) in the GeneticAlgorithm class.

Parameters
dimensionsThe requested number of dimensions

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