libcmaes 0.10.2
A C++11 library for stochastic optimization with CMA-ES
Loading...
Searching...
No Matches
cmastopcriteria.h
1
22#ifndef CMASTOPCRITERIA_H
23#define CMASTOPCRITERIA_H
24
25#include <libcmaes/cmaparameters.h>
26#include <functional>
27#include <map>
28
29namespace libcmaes
30{
31
32 class CMASolutions;
33
34 template <class TGenoPheno>
35 using StopCriteriaFunc = std::function<int (const CMAParameters<TGenoPheno> &cmap, const CMASolutions &cmas)>;
36
37 enum CMAStopCritType
38 {
39 CONT = 0,
40 AUTOMAXITER = 7,
41 TOLHISTFUN = 1, // convergence
42 EQUALFUNVALS = 5, // partial success, user error
43 TOLX = 2, // partial success
44 TOLUPSIGMA = -13,
45 STAGNATION = 6, // partial success
46 CONDITIONCOV = -15, // error, user action needed
47 NOEFFECTAXIS = 3, // partial success
48 NOEFFECTCOOR = 4, // partial success
49 MAXFEVALS = 8,
50 MAXITER = 9,
51 FTARGET = 10 // success
52 };
53
54 template <class TGenoPheno=NoBoundStrategy>
56 {
57 public:
59 :_sfunc(sfunc)
60 {}
61 ~StopCriteria() {}
62
63 inline bool active() const { return _active; }
64
65 void set_active(const bool &a) { _active = a; }
66
68 bool _active = true;
69 };
70
74 template <class TGenoPheno=NoBoundStrategy>
76 {
77 friend class CMASolutions;
78
79 public:
86
93 int stop(const CMAParameters<TGenoPheno> &cmap, const CMASolutions &cmas) const;
94
101 int set_criteria_active(const int &c, const bool &active);
102
103 private:
104 std::map<int,StopCriteria<TGenoPheno> > _scriteria;
105 bool _active;
106 static std::map<int,std::string> _scriterias;
107 };
108
109}
110
111#endif
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
bool _active
Definition cmastopcriteria.h:105
std::map< int, StopCriteria< TGenoPheno > > _scriteria
Definition cmastopcriteria.h:104
an optimizer main class.
Definition esoptimizer.h:72
Definition cmastopcriteria.h:56
linear scaling of the parameter space to achieve similar sensitivity across all components.
Definition acovarianceupdate.h:30