EvolvingObjects
|
Public Member Functions | |
CMAState (const CMAParams &, const std::vector< double > &initial_point, const double initial_sigma=1.0) | |
CMAState (const CMAState &) | |
CMAState & | operator= (const CMAState &) |
void | sample (std::vector< double > &v) const |
sample a vector from the distribution | |
void | reestimate (const std::vector< const std::vector< double > * > &sorted_population, double muBest, double muWorst) |
Reestimate covariance matrix and other internal parameters Does NOT update the eigen system (call that seperately) | |
bool | updateEigenSystem (unsigned max_tries=1, unsigned max_iters=0) |
call this function after reestimate in order to update the eigen system It is a seperate call to allow the user to periodically skip this expensive step | |
Private Attributes | |
CMAStateImpl * | pimpl |
Definition at line 23 of file CMAState.h.
void eo::CMAState::sample | ( | std::vector< double > & | v | ) | const |
sample a vector from the distribution
If the sample is not to your liking (i.e., not within bounds) you can do one of two things:
a) Call sample again b) multiply the entire vector with a number between -1 and 1
Do not modify the sample in any other way as this will invalidate the internal consistency of the system.
A final approach is to copy the sample and modify the copy externally (in the evaluation function) and possibly add a penalty depending on the size of the modification.
Definition at line 358 of file CMAState.cpp.
Referenced by eoCMABreed< FitT >::operator()(), and eoCMAInit< FitT >::operator()().
void eo::CMAState::reestimate | ( | const std::vector< const std::vector< double > * > & | sorted_population, |
double | muBest, | ||
double | muWorst | ||
) |
Reestimate covariance matrix and other internal parameters Does NOT update the eigen system (call that seperately)
Needs a population of mu individuals, sorted on fitness, plus
muBest: the best fitness in the population muWorst: the worst fitness in the population
Definition at line 360 of file CMAState.cpp.
Referenced by eoCMABreed< FitT >::operator()().
bool eo::CMAState::updateEigenSystem | ( | unsigned | max_tries = 1 , |
unsigned | max_iters = 0 |
||
) |
call this function after reestimate in order to update the eigen system It is a seperate call to allow the user to periodically skip this expensive step
max_iters = 0 implies 30 * N iterations
If after max_tries still no numerically sound eigen system is constructed, the function returns false
Definition at line 361 of file CMAState.cpp.
Referenced by eoCMABreed< FitT >::operator()().