This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sample from a normal distribution, truncated between -1 and 1 | |
double MultiObjectiveCompactDifferentialEvolution::sampleValue(double mu, double sigma) { | |
if (sigma < 1e-8) // Should avoid infinity error below | |
return mu; | |
try { | |
double sqrt2Sigma = SQRT_2 * sigma; | |
double erfMuNeg = boost::math::erf((mu - 1) / sqrt2Sigma); | |
double erfMuPlus = boost::math::erf((mu + 1) / sqrt2Sigma); |