25#include <libcmaes/eo_matrix.h>
26#include <libcmaes/genopheno.h>
27#include <libcmaes/llogging.h>
31#include <unordered_map>
40 template <
class TGenoPheno=GenoPheno<NoBoundStrategy> >
44 template <
class U,
class V>
friend class CMAStrategy;
45 template <
class U,
class V,
class W>
friend class ESOStrategy;
51 template <
class U>
friend class errstats;
81 _seed =
static_cast<uint64_t>(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now().
time_since_epoch()).count());
206 std::unordered_map<int,double>::iterator
mit;
261 _ftarget = -std::numeric_limits<double>::infinity();
280 _seed =
static_cast<uint64_t>(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now().
time_since_epoch()).count());
567 double _ftarget = -std::numeric_limits<double>::infinity();
599 double _tpa_csigma = 0.3;
ACM Surrogate strategy for CMA-ES, follows: 'Surrogate-Assisted Evolutionary Algorithms',...
Definition surrogatestrategy.h:295
Active Covariance Matrix update. This implementation closely follows N. Hansen, R....
Definition acovarianceupdate.h:39
Implementation of the BIPOP flavor of CMA-ES, with restarts that control the population of offsprings...
Definition bipopcmastrategy.h:38
Holder of the set of evolving solutions from running an instance of CMA-ES.
Definition cmasolutions.h:42
CMA-ES termination criteria, see reference paper in cmastrategy.h.
Definition cmastopcriteria.h:76
This is an implementation of CMA-ES. It uses the reference algorithm and termination criteria of the ...
Definition cmastrategy.h:46
candidate solution point, in function parameter space.
Definition candidate.h:34
Covariance Matrix update. This is an implementation closely follows: Hansen, N. (2009)....
Definition covarianceupdate.h:38
Main class describing an evolutionary optimization strategy. Every algorithm in libcmaes descends fro...
Definition esostrategy.h:52
an optimizer main class.
Definition esoptimizer.h:72
Implementation of the IPOP flavor of CMA-ES, with restarts that linearly increase the population of o...
Definition ipopcmastrategy.h:36
Generic class for Evolution Strategy parameters.
Definition parameters.h:42
bool _full_fplot
Definition parameters.h:564
bool get_edm() const
returns whether edm is activated.
Definition parameters.h:461
bool get_gradient() const
returns whether the gradient injection scheme is activated.
Definition parameters.h:443
Parameters(const int &dim, const double *x0, const int &lambda=-1, const uint64_t &seed=0, const TGenoPheno &gp=GenoPheno< NoBoundStrategy >())
constructor
Definition parameters.h:74
double get_ftarget() const
returns objective function target value.
Definition parameters.h:268
void set_max_hist(const int &m)
sets maximum history size, allows to keep memory requirements fixed.
Definition parameters.h:488
int get_max_iter() const
returns maximum number of iterations
Definition parameters.h:224
bool get_maximize() const
returns whether the maximization mode is enabled
Definition parameters.h:506
TGenoPheno get_gp() const
returns the current genotype/phenotype transform object.
Definition parameters.h:395
void set_x0(const double &x0min, const double &x0max)
sets bounds on initial objective function parameter values. Bounds are the same across all dimensions...
Definition parameters.h:126
void set_fixed_p(const int &index, const double &value)
freezes a parameter to a given value during optimization.
Definition parameters.h:195
double _rlambda
Definition parameters.h:591
void set_gradient(const bool &gradient)
activates the gradient injection scheme. If no gradient function is defined, injects a numerical grad...
Definition parameters.h:432
int get_max_fevals() const
returns maximum budget of objective function calls
Definition parameters.h:242
void set_uh(const bool &b)
activates / deactivates uncertainty handling scheme.
Definition parameters.h:524
bool _initial_fvalue
Definition parameters.h:587
bool quiet() const
returns whether the quiet mode is on.
Definition parameters.h:359
void set_full_fplot(const bool &b)
activates / deactivates the full output (for legacy plotting).
Definition parameters.h:413
bool _uh
Definition parameters.h:590
void set_x0(const double *x0)
sets initial objective function parameter values to array x0
Definition parameters.h:102
void unset_fixed_p(const int &index)
unfreezes a parameter.
Definition parameters.h:204
bool get_mt_feval() const
returns whether the parallel evaluation of objective function is activated
Definition parameters.h:479
static std::map< std::string, int > _algos
Definition parameters.h:585
int _max_iter
Definition parameters.h:559
void set_x0(const double &x0)
sets initial objective function parameter values to x0 across all dimensions
Definition parameters.h:93
int lambda() const
returns lambda, number of offsprings per generation
Definition parameters.h:332
void set_maximize(const bool &maximize)
active internal maximization scheme (simply returns -f instead of f)
Definition parameters.h:497
Parameters()
empty constructor.
Definition parameters.h:63
dVec get_x0max() const
returns upper bound on x0 vector
Definition parameters.h:185
void set_ftarget(const double &val)
sets the objective function target value when known.
Definition parameters.h:251
bool get_uh() const
get uncertainty handling status.
Definition parameters.h:533
int _max_hist
Definition parameters.h:582
bool _quiet
Definition parameters.h:562
void set_mt_feval(const bool &mt)
activate / deactivate the parallel evaluation of objective function
Definition parameters.h:470
dVec get_x0min() const
returns lower bound on x0 vector
Definition parameters.h:176
void set_x0(const dVec &x0)
sets initial objective function parameter values from Eigen vector
Definition parameters.h:113
bool _mt_feval
Definition parameters.h:581
int _algo
Definition parameters.h:572
double get_ftolerance() const
returns function tolerance
Definition parameters.h:305
double _ftarget
Definition parameters.h:567
std::unordered_map< int, double > _fixed_p
Definition parameters.h:577
bool _maximize
Definition parameters.h:584
int get_seed() const
returns random generator's seed.
Definition parameters.h:288
std::string get_fplot() const
returns the current output filename.
Definition parameters.h:422
int _tpa
Definition parameters.h:598
int dim() const
returns the problem's dimension
Definition parameters.h:341
void set_xtolerance(const double &v)
sets parameter tolerance as stopping criteria for TolX.
Definition parameters.h:314
dVec _x0min
Definition parameters.h:565
std::string _fplot
Definition parameters.h:563
void set_max_fevals(const int &fevals)
sets the maximum budget of objective function calls allowed for the optimization.
Definition parameters.h:233
double _xtol
Definition parameters.h:569
double get_xtolerance() const
returns parameter tolerance
Definition parameters.h:323
double _ftolerance
Definition parameters.h:568
double _epsuh
Definition parameters.h:592
TGenoPheno _gp
Definition parameters.h:579
void set_fplot(const std::string &fplot)
sets the output filename (activates the output to file).
Definition parameters.h:404
void set_tpa(const int &b)
activates / deactivates two-point adaptation step-size mechanism
Definition parameters.h:542
void set_seed(const int &seed)
sets random generator's seed, 0 is special value to generate random seed.
Definition parameters.h:277
void set_edm(const bool &edm)
activates computation of expected distance to minimum when optimization has completed
Definition parameters.h:452
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...
Definition parameters.h:155
uint64_t _seed
Definition parameters.h:571
void set_x0(const dVec &x0min, const dVec &x0max)
sets bounds on initial objective function parameter values. Initial value is sampled uniformly within...
Definition parameters.h:166
double _csuh
Definition parameters.h:594
void set_max_iter(const int &maxiter)
sets the maximum number of iterations allowed for the optimization.
Definition parameters.h:215
void set_ftolerance(const double &v)
sets function tolerance as stopping criteria for TolHistFun: monitors the difference in function valu...
Definition parameters.h:299
int get_tpa() const
get two-point adapation step-size mechanism status.
Definition parameters.h:551
int _max_fevals
Definition parameters.h:560
bool _with_edm
Definition parameters.h:575
void set_x0(const double *x0min, const double *x0max)
sets bounds on initial objective function parameter values. Initial value is sampled uniformly within...
Definition parameters.h:138
int get_algo() const
returns which algorithm is set for the optimization at hand.
Definition parameters.h:377
void set_quiet(const bool &quiet)
sets the quiet mode (no output from the library) for the optimization at hand
Definition parameters.h:350
void set_algo(const int &algo)
sets the optimization algorithm.
Definition parameters.h:368
void reset_ftarget()
resets the objective function target value to its inactive state.
Definition parameters.h:259
dVec _x0max
Definition parameters.h:566
void set_gp(const TGenoPheno &gp)
sets the genotype/phenotype transform object.
Definition parameters.h:386
double _thetauh
Definition parameters.h:593
int _lambda
Definition parameters.h:558
void set_initial_fvalue(const bool &b)
whether to compute initial objective function value (i.e. at x0)
Definition parameters.h:515
double _alphathuh
Definition parameters.h:595
bool _with_gradient
Definition parameters.h:574
int _dim
Definition parameters.h:557
Simple surrogate strategy: trains every n steps, and exploits in between, mostly as an example and fo...
Definition surrogatestrategy.h:216
VD-CMA update that is a linear time/space variant of CMA-ES This is an implementation that closely fo...
Definition vdcmaupdate.h:39
linear scaling of the parameter space to achieve similar sensitivity across all components.
Definition acovarianceupdate.h:30