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