Genetic Algorithm.
More...
#include <genetic_algorithm.h>
|
| GeneticAlgorithm (std::shared_ptr< Problem > &data, int numIndividuals, int numGenerations) |
| Constructor. More...
|
|
| GeneticAlgorithm (std::shared_ptr< Problem > &data, int numIndividuals, int numGenerations, int numThreads) |
| Constructor. More...
|
|
| GeneticAlgorithm (std::shared_ptr< Problem > &data, std::shared_ptr< ExpDesign > &expDes, int numIndividuals, int numGenerations) |
| Constructor. More...
|
|
| GeneticAlgorithm (std::shared_ptr< Problem > &data, std::shared_ptr< ExpDesign > &expDes, int numIndividuals, int numGenerations, int numThreads) |
| Constructor. More...
|
|
Result | run () |
| Runs the optimization algorithm. More...
|
|
Genetic Algorithm.
This is an implementation of the popular Genetic Algorithm. The implementation is of a real-valued GA and the mutation operator used is a normally distributed perturbation. The number of evaluations carried out by the method is mNumIndividuals * mNumGenerations.
- Author
- David Eriksson, dme65.nosp@m.@cor.nosp@m.nell..nosp@m.edu
sot::GeneticAlgorithm::GeneticAlgorithm |
( |
std::shared_ptr< Problem > & |
data, |
|
|
int |
numIndividuals, |
|
|
int |
numGenerations |
|
) |
| |
|
inline |
Constructor.
- Parameters
-
data | A shared pointer to the optimization problem |
numIndividuals | Number of individuals in the population |
numGenerations | Number of generations |
sot::GeneticAlgorithm::GeneticAlgorithm |
( |
std::shared_ptr< Problem > & |
data, |
|
|
int |
numIndividuals, |
|
|
int |
numGenerations, |
|
|
int |
numThreads |
|
) |
| |
|
inline |
Constructor.
- Parameters
-
data | A shared pointer to the optimization problem |
numIndividuals | Number of individuals in the population |
numGenerations | Number of generations |
numThreads | Number of threads |
sot::GeneticAlgorithm::GeneticAlgorithm |
( |
std::shared_ptr< Problem > & |
data, |
|
|
std::shared_ptr< ExpDesign > & |
expDes, |
|
|
int |
numIndividuals, |
|
|
int |
numGenerations |
|
) |
| |
|
inline |
Constructor.
- Parameters
-
data | A shared pointer to the optimization problem |
expDes | Experimental design used to generate the initial population |
numIndividuals | Number of individuals in the population |
numGenerations | Number of generations |
- Exceptions
-
std::logic_error | if the size of the experimental design doesn't match |
sot::GeneticAlgorithm::GeneticAlgorithm |
( |
std::shared_ptr< Problem > & |
data, |
|
|
std::shared_ptr< ExpDesign > & |
expDes, |
|
|
int |
numIndividuals, |
|
|
int |
numGenerations, |
|
|
int |
numThreads |
|
) |
| |
|
inline |
Constructor.
- Parameters
-
data | A shared pointer to the optimization problem |
expDes | A shared pointer to the experimental design |
numIndividuals | Number of individuals in the population |
numGenerations | Number of generations |
numThreads | Number of threads |
void sot::GeneticAlgorithm::evalBatch |
( |
const mat & |
batch, |
|
|
vec & |
funVals |
|
) |
| |
|
inlineprotected |
Evalaute a batch of points in parallel.
- Parameters
-
batch | Batch of points to be evaluated |
funVals | Vector to write the function values to |
Result sot::GeneticAlgorithm::run |
( |
| ) |
|
|
inline |
Runs the optimization algorithm.
- Returns
- A Result object with the results from the run
std::shared_ptr<Problem> sot::GeneticAlgorithm::mData |
|
protected |
A shared pointer to the optimization problem
int sot::GeneticAlgorithm::mDim |
|
protected |
Number of dimensions (extracted from mData)
int sot::GeneticAlgorithm::mEvalCount = 0 |
|
protected |
Evaluation counter for evalauting batches
std::shared_ptr<ExpDesign> sot::GeneticAlgorithm::mExpDes |
|
protected |
A shared pointer to the experimental design (if used)
std::mutex sot::GeneticAlgorithm::mMutex |
|
protected |
Mutex for assigning evaluations to the threads
std::string sot::GeneticAlgorithm::mName = "Genetic Algorithm" |
|
protected |
int sot::GeneticAlgorithm::mNumGenerations |
|
protected |
int sot::GeneticAlgorithm::mNumIndividuals |
|
protected |
Number of individuals in the population
int sot::GeneticAlgorithm::mNumThreads |
|
protected |
int sot::GeneticAlgorithm::mNumVariables |
|
protected |
Number of variables (extracted from mData)
double sot::GeneticAlgorithm::mpCross = 0.9 |
|
protected |
double sot::GeneticAlgorithm::mpMutation |
|
protected |
bool sot::GeneticAlgorithm::mRandomInit |
|
protected |
True if the initial population is uniformly random
double sot::GeneticAlgorithm::mSigma = 0.2 |
|
protected |
Standard deviation for the mutatio w.r.t. the unit box
int sot::GeneticAlgorithm::mTournamentSize = 5 |
|
protected |
vec sot::GeneticAlgorithm::mxLow |
|
protected |
Lower variable bounds (extracted from mData)
vec sot::GeneticAlgorithm::mxUp |
|
protected |
Upper variable bounds (extracted from mData)
The documentation for this class was generated from the following file: