| libcmaes 0.10.2
    A C++11 library for stochastic optimization with CMA-ES | 
ACM Surrogate strategy for CMA-ES, follows: 'Surrogate-Assisted Evolutionary Algorithms', Ilya Loshchilov, PhD Thesis, Universite Paris-Sud 11, 2013. http://www.loshchilov.com/phd.html see Chapter 4. More...
#include <libcmaes/surrogatestrategy.h>
 
  
| Public Member Functions | |
| ACMSurrogateStrategy (FitFunc &func, CMAParameters< TGenoPheno > ¶meters) | |
| constructor | |
| dMat | ask () | 
| Generates a set of candidate points. Uses the pre-sampling of a larger than usual number of offprings, controled by 'lambdaprime', as needed. | |
| void | eval (const dMat &candidates, const dMat &phenocandidates=dMat(0, 0)) | 
| Evaluates a set of candiates against the objective function or the surrogate model, as needed. | |
| void | tell () | 
| Updates the state of the stochastic search, and prepares for the next iteration by training the surrogate model, as needed. | |
| int | optimize () | 
| bool | do_train () const | 
| whether to train the model | |
| void | set_lambdaprime (const int &lp) | 
| sets the number of true objective function calls per iteration | |
| int | get_lambdaprime () const | 
| returns the number of calls to the true objective function per iteration | |
| void | set_prelambda (const int &pl) | 
| sets the number of pre-screened offsprings (sampled) | |
| int | get_prelambda () const | 
| returns the current number of pre-screened offpsrings (sampled) | |
| void | set_theta_sel0 (const double &s) | 
| sets the standard deviation of selection sampling step 0 | |
| double | get_theta_sel0 () const | 
| returns the standard deviation of selection sampling step 0 | |
| void | set_theta_sel1 (const double &s) | 
| sets the standard deviation of selection sampling step 1 | |
| double | get_theta_sel1 () const | 
| returns the standard deviation of selection sampling step 0 | |
|  Public Member Functions inherited from libcmaes::SurrogateStrategy< TStrategy, TCovarianceUpdate, TGenoPheno > | |
| SurrogateStrategy (FitFunc &func, CMAParameters< TGenoPheno > ¶meters) | |
| constructor | |
| int | train (const std::vector< Candidate > &candidates, const dMat &cov) | 
| train a surrogate model | |
| int | predict (std::vector< Candidate > &candidates, const dMat &cov) | 
| predict from a surrogate model | |
| double | compute_error (const std::vector< Candidate > &test_set, const dMat &cov=dMat(0, 0)) | 
| compute surrogate model error (copies and sorts the test_set) | |
| bool | do_train () const | 
| conditionals on training, to be specialized in inherited surrogate strategies | |
| void | set_ftrain (const CSurrFunc &train) | 
| sets the training function | |
| void | set_fpredict (const SurrFunc &predict) | 
| sets the prediction function | |
| void | set_l (const int &l) | 
| sets the size of the training set (number of points) | |
| int | get_l () const | 
| gets the size of the training set (number of points) | |
| void | set_exploit (const bool &exploit) | 
| sets whether to exploit the surrogate model | |
| bool | get_exploit () const | 
| gets the state of surrogate model exploitation | |
| double | get_train_error () const | 
| returns the surrogate model training error | |
| double | get_test_error () const | 
| returns the surrogate model test error | |
| void | set_train_error (const double &err) | 
| sets training error | |
| void | set_test_error (const double &err) | 
| sets the test error and updates the smoothed test err. | |
| void | add_to_training_set (const Candidate &c) | 
| adds a point to the training set (candidate = points + objective function value) | |
| void | set_nsteps (const int &nsteps) | 
| sets the lifelength of the surrogate, i.e. the number of steps in between to training steps | |
| void | reset_training_set () | 
| resets training set and related information, useful when using algorithms with restarts | |
| int | get_nsteps () const | 
| returns the current surrogate lifelength | |
| Protected Member Functions | |
| void | pre_selection_eval (const dMat &candidates) | 
| pre-selection + candidate evaluation scheme. Called by eval, evaluates lambdaprime candidates with surrogate model, then subsample the population in order to evaluate them with the original objective function, test the surrogate model and grow the training set with new points | |
| Protected Attributes | |
| double | _prelambda = 500 | 
| double | _theta_sel0 = 0.4 | 
| double | _theta_sel1 = 0.8 | 
| int | _lambdaprime | 
|  Protected Attributes inherited from libcmaes::SurrogateStrategy< TStrategy, TCovarianceUpdate, TGenoPheno > | |
| bool | _exploit = true | 
| int | _l = 200 | 
| std::vector< Candidate > | _tset | 
| CSurrFunc | _train | 
| SurrFunc | _predict | 
| double | _train_err = 0.0 | 
| double | _test_err = 0.0 | 
| double | _smooth_test_err = 0.5 | 
| double | _beta_err = 0.2 | 
| int | _nsteps = 1 | 
| int | _auto_nsteps = false | 
| Private Member Functions | |
| void | init_rd () | 
| Private Attributes | |
| std::random_device | _rd | 
| std::normal_distribution< double > | _norm_sel0 | 
| std::normal_distribution< double > | _norm_sel1 | 
| std::mt19937 | _gen0 | 
| std::mt19937 | _gen1 | 
ACM Surrogate strategy for CMA-ES, follows: 'Surrogate-Assisted Evolutionary Algorithms', Ilya Loshchilov, PhD Thesis, Universite Paris-Sud 11, 2013. http://www.loshchilov.com/phd.html see Chapter 4.
Implements a single-objective strategy for CMA-ES and related algorithms, that samples ans pre-screens a larger than usual number of offsprings at each generation, rank them with a rank-based surrogate model, and consumes a small portion of offsprings with the original (supposedly expensive) objective function.
This strategy overrides the ask/eval/tell functions of the base optimization strategy
| libcmaes::ACMSurrogateStrategy< TStrategy, TCovarianceUpdate, TGenoPheno >::ACMSurrogateStrategy | ( | FitFunc & | func, | 
| CMAParameters< TGenoPheno > & | parameters | ||
| ) | 
constructor
| func | objective function to minimize | 
| parameters | optimization parameters | 
| dMat libcmaes::ACMSurrogateStrategy< TStrategy, TCovarianceUpdate, TGenoPheno >::ask | ( | ) | 
Generates a set of candidate points. Uses the pre-sampling of a larger than usual number of offprings, controled by 'lambdaprime', as needed.
Note: this function overrides the default ESOStrategy::ask
| 
 | inline | 
whether to train the model
| void libcmaes::ACMSurrogateStrategy< TStrategy, TCovarianceUpdate, TGenoPheno >::eval | ( | const dMat & | candidates, | 
| const dMat & | phenocandidates = dMat(0,0) | ||
| ) | 
Evaluates a set of candiates against the objective function or the surrogate model, as needed.
Note: this function overrides the default CMAStrategy::eval
| candidates | A matrix whose rows contain the candidates. | 
| phenocandidates | The candidates transformed into phenotype, leave empty if no pheno transform. | 
| 
 | inline | 
returns the number of calls to the true objective function per iteration
| 
 | inline | 
returns the current number of pre-screened offpsrings (sampled)
| 
 | inline | 
returns the standard deviation of selection sampling step 0
| 
 | inline | 
returns the standard deviation of selection sampling step 0
| 
 | protected | 
pre-selection + candidate evaluation scheme. Called by eval, evaluates lambdaprime candidates with surrogate model, then subsample the population in order to evaluate them with the original objective function, test the surrogate model and grow the training set with new points
| candidates | A matrix whose rows contain the candidates. | 
| 
 | inline | 
sets the number of true objective function calls per iteration
| lp | true objective function calls per iteration | 
| 
 | inline | 
sets the number of pre-screened offsprings (sampled)
| number | of offsprings | 
| 
 | inline | 
sets the standard deviation of selection sampling step 0
| s | standard deviation | 
| 
 | inline | 
sets the standard deviation of selection sampling step 1
| s | standard deviation | 
| void libcmaes::ACMSurrogateStrategy< TStrategy, TCovarianceUpdate, TGenoPheno >::tell | ( | ) | 
Updates the state of the stochastic search, and prepares for the next iteration by training the surrogate model, as needed.
Note: this function overrides the default CMAStrategy::tell
| 
 | protected | 
true objective function calls per iteration.
| 
 | protected | 
number of pre-screened offsprings.
| 
 | protected | 
standard deviation of selection sampling step 0.
| 
 | protected | 
standard deviation of selection sampling step 1.