25 #include "eo_matrix.h"
26 #include "candidate.h"
32 typedef std::function<double (const double*, const int &n)> FitFunc;
33 typedef std::function<dVec (const double*, const int &n)> GradFunc;
35 typedef std::function<void(const dMat&, const dMat&)> EvalFunc;
36 typedef std::function<dMat(void)> AskFunc;
37 typedef std::function<void(void)> TellFunc;
39 template<
class TParameters,
class TSolutions>
40 using ProgressFunc = std::function<int (const TParameters&, const TSolutions&)>;
42 template<
class TParameters,
class TSolutions>
43 using PlotFunc = std::function<int (const TParameters&, const TSolutions&, std::ofstream &fplotstream)>;
50 template<
class TParameters,
class TSolutions,
class TStopCriteria>
67 TParameters ¶meters);
76 TParameters ¶meters,
77 const TSolutions &solutions);
98 void eval(
const dMat &candidates,
99 const dMat &phenocandidates=dMat(0,0));
122 int optimize(
const EvalFunc &evalf,
const AskFunc &askf,
const TellFunc &tellf);
156 _parameters.set_x0(sol.best_candidate().get_x_dvec());
174 dVec
gradf(
const dVec &x);
181 dVec
gradgp(
const dVec &x)
const;
232 ProgressFunc<TParameters,TSolutions>
_pfunc;
240 std::uniform_real_distribution<> _uhunif;
void update_fevals(const int &evals)
updates the consumed budget of objective function evaluations.
Definition: esostrategy.cc:192
bool _initial_elitist
Definition: esostrategy.h:236
TParameters & get_parameters()
returns reference to current optimization parameters object
Definition: esostrategy.h:199
double fitfunc(const double *x, const int N)
execute objective function
Definition: esostrategy.h:207
void set_plot_func(PlotFunc< TParameters, TSolutions > &pffunc)
Sets the possibly custom plot to file function, that is useful for storing into file various possibly...
Definition: esostrategy.h:167
FitFunc _func
Definition: esostrategy.h:227
dVec gradf(const dVec &x)
returns numerical gradient of objective function at x.
Definition: esostrategy.cc:199
void set_progress_func(ProgressFunc< TParameters, TSolutions > &pfunc)
Sets the possibly custom progress function, that is called in between every search step...
Definition: esostrategy.h:148
GradFunc _gfunc
Definition: esostrategy.h:233
int _niter
Definition: esostrategy.h:229
Main class describing an evolutionary optimization strategy. Every algorithm in libcmaes descends fro...
Definition: esostrategy.h:51
TSolutions & get_solutions()
returns reference to current solution object
Definition: esostrategy.h:193
void uncertainty_handling()
uncertainty handling scheme that computes and uncertainty level based on a dual candidate ranking...
Definition: esostrategy.cc:245
int _nevals
Definition: esostrategy.h:228
void eval(const dMat &candidates, const dMat &phenocandidates=dMat(0, 0))
Evaluates a set of candidates against the objective function. The procedure is multithreaded and stor...
Definition: esostrategy.cc:84
ProgressFunc< TParameters, TSolutions > _pfunc
Definition: esostrategy.h:232
linear scaling of the parameter space to achieve similar sensitivity across all components.
Definition: acovarianceupdate.cc:25
void start_from_solution(const TSolutions &sol)
starts optimization from a given solution object.
Definition: esostrategy.h:154
int optimize(const EvalFunc &evalf, const AskFunc &askf, const TellFunc &tellf)
Finds the minimum of the objective function. It makes alternative calls to ask(), tell() and stop() u...
ESOStrategy()
dummy constructor.
Definition: esostrategy.h:57
candidate solution point, in function parameter space.
Definition: candidate.h:33
void inc_iter()
increment iteration count.
Definition: esostrategy.cc:185
PlotFunc< TParameters, TSolutions > _pffunc
Definition: esostrategy.h:234
void set_gradient_func(GradFunc &gfunc)
sets the gradient function, if available.
Definition: esostrategy.h:139
void tpa_update()
updates the two-point adaptation average rank difference for the step-size adaptation mechanism ...
Definition: esostrategy.cc:359
TSolutions _solutions
Definition: esostrategy.h:230
dVec gradgp(const dVec &x) const
returns the numerical gradient of the objective function in phenotype space
Definition: esostrategy.cc:220
void tell()
Updates the state of the stochastic search, and prepares for the next iteration.
double edm()
computes expected distance to minimum (EDM).
Definition: esostrategy.cc:227
TParameters _parameters
Definition: esostrategy.h:231
bool stop()
Decides whether to stop the search for solutions.
dMat ask()
Generates a set of candidate points.