|
libcmaes
A C++11 library for stochastic optimization with CMA-ES
|
Generic class for Evolution Strategy parameters. More...
#include <parameters.h>
Public Member Functions | |
| Parameters () | |
| empty constructor. | |
| Parameters (const int &dim, const double *x0, const int &lambda=-1, const uint64_t &seed=0, const TGenoPheno &gp=GenoPheno< NoBoundStrategy >()) | |
| constructor More... | |
| void | set_x0 (const double &x0) |
| sets initial objective function parameter values to x0 across all dimensions More... | |
| void | set_x0 (const double *x0) |
| sets initial objective function parameter values to array x0 More... | |
| void | set_x0 (const dVec &x0) |
| sets initial objective function parameter values from Eigen vector More... | |
| void | set_x0 (const double &x0min, const double &x0max) |
| sets bounds on initial objective function parameter values. Bounds are the same across all dimensions, and initial value is sampled uniformly within these bounds. More... | |
| void | set_x0 (const double *x0min, const double *x0max) |
| sets bounds on initial objective function parameter values. Initial value is sampled uniformly within these bounds. More... | |
| void | set_x0 (const std::vector< double > &x0min, const std::vector< double > &x0max) |
| sets bounds on initial objective function parameter values. Initial value is sampled uniformly within these bounds. More... | |
| void | set_x0 (const dVec &x0min, const dVec &x0max) |
| sets bounds on initial objective function parameter values. Initial value is sampled uniformly within these bounds. More... | |
| dVec | get_x0min () const |
| returns lower bound on x0 vector More... | |
| dVec | get_x0max () const |
| returns upper bound on x0 vector More... | |
| void | set_fixed_p (const int &index, const double &value) |
| freezes a parameter to a given value during optimization. More... | |
| void | unset_fixed_p (const int &index) |
| unfreezes a parameter. More... | |
| void | set_max_iter (const int &maxiter) |
| sets the maximum number of iterations allowed for the optimization. More... | |
| int | get_max_iter () const |
| returns maximum number of iterations More... | |
| void | set_max_fevals (const int &fevals) |
| sets the maximum budget of objective function calls allowed for the optimization. More... | |
| int | get_max_fevals () const |
| returns maximum budget of objective function calls More... | |
| void | set_ftarget (const double &val) |
| sets the objective function target value when known. More... | |
| void | reset_ftarget () |
| resets the objective function target value to its inactive state. | |
| double | get_ftarget () const |
| returns objective function target value. More... | |
| void | set_seed (const int &seed) |
| sets random generator's seed, 0 is special value to generate random seed. More... | |
| int | get_seed () const |
| returns random generator's seed. More... | |
| void | set_ftolerance (const double &v) |
| sets function tolerance as stopping criteria for TolHistFun: monitors the difference in function value over iterations and stops optimization when below tolerance. More... | |
| double | get_ftolerance () const |
| returns function tolerance More... | |
| void | set_xtolerance (const double &v) |
| sets parameter tolerance as stopping criteria for TolX. More... | |
| double | get_xtolerance () const |
| returns parameter tolerance More... | |
| int | lambda () const |
| returns lambda, number of offsprings per generation More... | |
| int | dim () const |
| returns the problem's dimension More... | |
| void | set_quiet (const bool &quiet) |
| sets the quiet mode (no output from the library) for the optimization at hand More... | |
| bool | quiet () const |
| returns whether the quiet mode is on. More... | |
| void | set_algo (const int &algo) |
| sets the optimization algorithm. More... | |
| int | get_algo () const |
| returns which algorithm is set for the optimization at hand. More... | |
| void | set_gp (const TGenoPheno &gp) |
| sets the genotype/phenotype transform object. More... | |
| TGenoPheno | get_gp () const |
| returns the current genotype/phenotype transform object. More... | |
| void | set_fplot (const std::string &fplot) |
| sets the output filename (activates the output to file). More... | |
| void | set_full_fplot (const bool &b) |
| activates / deactivates the full output (for legacy plotting). More... | |
| std::string | get_fplot () const |
| returns the current output filename. More... | |
| void | set_gradient (const bool &gradient) |
| activates the gradient injection scheme. If no gradient function is defined, injects a numerical gradient solution instead More... | |
| bool | get_gradient () const |
| returns whether the gradient injection scheme is activated. More... | |
| void | set_edm (const bool &edm) |
| activates computation of expected distance to minimum when optimization has completed More... | |
| bool | get_edm () const |
| returns whether edm is activated. More... | |
| void | set_mt_feval (const bool &mt) |
| activate / deactivate the parallel evaluation of objective function More... | |
| bool | get_mt_feval () const |
| returns whether the parallel evaluation of objective function is activated More... | |
| void | set_max_hist (const int &m) |
| sets maximum history size, allows to keep memory requirements fixed. More... | |
| void | set_maximize (const bool &maximize) |
| active internal maximization scheme (simply returns -f instead of f) More... | |
| bool | get_maximize () const |
| returns whether the maximization mode is enabled More... | |
| void | set_initial_fvalue (const bool &b) |
| whether to compute initial objective function value (i.e. at x0) More... | |
| void | set_uh (const bool &b) |
| activates / deactivates uncertainty handling scheme. More... | |
| bool | get_uh () const |
| get uncertainty handling status. More... | |
| void | set_tpa (const int &b) |
| activates / deactivates two-point adaptation step-size mechanism More... | |
| int | get_tpa () const |
| get two-point adapation step-size mechanism status. More... | |
Protected Attributes | |
| int | _dim |
| int | _lambda = -1 |
| int | _max_iter = -1 |
| int | _max_fevals = -1 |
| bool | _quiet = true |
| std::string | _fplot = "" |
| bool | _full_fplot = false |
| dVec | _x0min |
| dVec | _x0max |
| double | _ftarget = -std::numeric_limits<double>::infinity() |
| double | _ftolerance = 1e-12 |
| double | _xtol = 1e-12 |
| uint64_t | _seed = 0 |
| int | _algo = 0 |
| bool | _with_gradient =false |
| bool | _with_edm =false |
| std::unordered_map< int, double > | _fixed_p |
| TGenoPheno | _gp |
| bool | _mt_feval = false |
| int | _max_hist = -1 |
| bool | _maximize = false |
| bool | _initial_fvalue = false |
| bool | _uh = false |
| double | _rlambda |
| double | _epsuh = 1e-7 |
| double | _thetauh = 0.2 |
| double | _csuh = 1.0 |
| double | _alphathuh = 1.0 |
| int | _tpa = 1 |
| double | _tpa_csigma = 0.3 |
Static Protected Attributes | |
| static std::map< std::string, int > | _algos = {{"cmaes",0},{"ipop",1},{"bipop",2},{"acmaes",3},{"aipop",4},{"abipop",5},{"sepcmaes",6},{"sepipop",7},{"sepbipop",8},{"sepacmaes",9},{"sepipop",10},{"sepbipop",11},{"vdcma",12},{"vdipopcma",13},{"vdbipopcma",14}} |
Generic class for Evolution Strategy parameters.
|
inline |
constructor
| dim | problem dimensions |
| x0 | initial search point |
| lambda | number of offsprings sampled at each step |
| seed | initial random seed, useful for reproducing results (if unspecified, automatically generated from current time) |
| gp | genotype / phenotype object |
|
inline |
returns the problem's dimension
|
inline |
returns which algorithm is set for the optimization at hand.
|
inline |
returns whether edm is activated.
|
inline |
returns the current output filename.
|
inline |
returns objective function target value.
|
inline |
returns function tolerance
|
inline |
returns the current genotype/phenotype transform object.
|
inline |
returns whether the gradient injection scheme is activated.
|
inline |
returns maximum budget of objective function calls
|
inline |
returns maximum number of iterations
|
inline |
returns whether the maximization mode is enabled
|
inline |
returns whether the parallel evaluation of objective function is activated
|
inline |
returns random generator's seed.
|
inline |
get two-point adapation step-size mechanism status.
|
inline |
get uncertainty handling status.
|
inline |
returns upper bound on x0 vector
|
inline |
returns lower bound on x0 vector
|
inline |
returns parameter tolerance
|
inline |
returns lambda, number of offsprings per generation
|
inline |
returns whether the quiet mode is on.
|
inline |
sets the optimization algorithm.
| algo | from CMAES_DEFAULT, IPOP_CMAES, BIPOP_CMAES, aCMAES, aIPOP_CMAES, aBIPOP_CMAES, sepCMAES, sepIPOP_CMAES, sepBIPOP_CMAES, sepaCMAES, sepaIPOP_CMAES, sepaBIPOP_CMAES, VD_CMAES, VD_IPOP_CMAES, VD_BIPOP_CMAES |
|
inline |
activates computation of expected distance to minimum when optimization has completed
| edm | true / false |
|
inline |
freezes a parameter to a given value during optimization.
| index | dimension index of the parameter to be frozen |
| value | frozen value of the parameter |
|
inline |
sets the output filename (activates the output to file).
| fplot | filename |
|
inline |
sets the objective function target value when known.
| val | objective function target value |
|
inline |
sets function tolerance as stopping criteria for TolHistFun: monitors the difference in function value over iterations and stops optimization when below tolerance.
| v | value of the function tolerance. |
|
inline |
activates / deactivates the full output (for legacy plotting).
| b | whether to activate / deactivate |
|
inline |
sets the genotype/phenotype transform object.
| gp | GenoPheno object |
|
inline |
activates the gradient injection scheme. If no gradient function is defined, injects a numerical gradient solution instead
| gradient | true/false |
|
inline |
whether to compute initial objective function value (i.e. at x0)
| b | activates / deactivates |
|
inline |
sets the maximum budget of objective function calls allowed for the optimization.
| fevals | maximum number of objective function evaluations |
|
inline |
sets maximum history size, allows to keep memory requirements fixed.
| m | number of steps of candidate history that are kept into memory (for stopping criteria equalfunvals mostly). |
|
inline |
sets the maximum number of iterations allowed for the optimization.
| maxiter | maximum number of allowed iterations |
|
inline |
active internal maximization scheme (simply returns -f instead of f)
| maximize | whether to maximize instead of minimizing |
|
inline |
activate / deactivate the parallel evaluation of objective function
| mt | true for activated, false otherwise |
|
inline |
sets the quiet mode (no output from the library) for the optimization at hand
| quiet | true / false |
|
inline |
sets random generator's seed, 0 is special value to generate random seed.
| seed | integer seed |
|
inline |
activates / deactivates two-point adaptation step-size mechanism
| b | 0: no, 1: auto, 2: yes |
|
inline |
activates / deactivates uncertainty handling scheme.
| b | activates / deactivates |
|
inline |
sets initial objective function parameter values to x0 across all dimensions
| x0 | initial value |
|
inline |
sets initial objective function parameter values to array x0
| x0 | array of initial parameter values |
|
inline |
|
inline |
sets bounds on initial objective function parameter values. Bounds are the same across all dimensions, and initial value is sampled uniformly within these bounds.
| x0min | lower bound |
| x0max | upper bound |
|
inline |
sets bounds on initial objective function parameter values. Initial value is sampled uniformly within these bounds.
| x0min | vector of initial lower bounds. |
| x0max | vector of initial upper bounds. |
|
inline |
sets bounds on initial objective function parameter values. Initial value is sampled uniformly within these bounds.
| x0min | vector of initial lower bounds. |
| x0max | vector of initial upper bounds. |
|
inline |
sets bounds on initial objective function parameter values. Initial value is sampled uniformly within these bounds.
| x0min | vector of initial lower bounds. |
| x0max | vector of initial upper bounds. |
|
inline |
sets parameter tolerance as stopping criteria for TolX.
| v | value of the parameter tolerance. |
|
inline |
unfreezes a parameter.
| index | dimenion index of the parameter to unfreeze |
|
protected |
selected algorithm.
|
staticprotected |
of the form { {"cmaes",0}, {"ipop",1}, ...}
|
protected |
factor of increasing the population spread.
|
protected |
learning rate for averaging the uncertainty measurement.
|
protected |
function space dimensions.
|
protected |
mutation strength for the reevaluation.
|
protected |
fixed parameters and values.
|
protected |
plotting file, if specified.
|
protected |
optional objective function target value.
|
protected |
tolerance of the best function values during the last 10+(30*dim/lambda) steps (TolHistFun).
|
protected |
whether to write to file full legacy data output.
|
protected |
genotype / phenotype object.
|
protected |
whether to compute initial objective function value (not required).
|
protected |
number of offsprings.
|
protected |
max budget as number of function evaluations.
|
protected |
max size of the history, keeps memory requirements fixed.
|
protected |
max iterations.
|
protected |
convenience option of maximizing -f instead of minimizing f.
|
protected |
whether to force multithreaded (i.e. parallel) function evaluations.
|
protected |
quiet all outputs.
|
protected |
fraction of solutions to be reevaluated.
|
protected |
seed for random generator.
|
protected |
control parameter for the acceptance threshold for the measured rank-change value.
|
protected |
whether to activate two-point adaptation, 0: no (forced), 1: auto, 2: yes (forced)
|
protected |
whether to activate uncertainty handling.
|
protected |
whether to compute expected distance to minimum when optimization has completed.
|
protected |
whether to use injected gradient.
|
protected |
initial mean vector max bound value for all components.
|
protected |
initial mean vector min bound value for all components.
|
protected |
tolerance on parameters error.
1.8.8