libcmaes
A C++11 library for stochastic optimization with CMA-ES
 All Classes Namespaces Functions Variables Typedefs
esoptimizer.h
1 
22 #ifndef ESOPTIMIZER_H
23 #define ESOPTIMIZER_H
24 
25 #include <functional>
26 #include <chrono>
27 #include "parameters.h"
28 #include "esostrategy.h"
29 #include "cmasolutions.h"
30 
31 /* algorithms */
32 enum {
33  /* vanilla version of CMA-ES. */
34  CMAES_DEFAULT = 0,
35  /* IPOP-CMA-ES */
36  IPOP_CMAES = 1,
37  /* BIPOP-CMA-ES */
38  BIPOP_CMAES = 2,
39  /* Active CMA-ES */
40  aCMAES = 3,
41  /* Active IPOP-CMA-ES */
42  aIPOP_CMAES = 4,
43  /* Active BIPOP-CMA-ES */
44  aBIPOP_CMAES = 5,
45  /* sep-CMA-ES */
46  sepCMAES = 6,
47  /* sep-IPOP-CMA-ES */
48  sepIPOP_CMAES = 7,
49  /* sep-BIPOP-CMA-ES */
50  sepBIPOP_CMAES = 8,
51  /* Active sep-CMA-ES */
52  sepaCMAES = 9,
53  /* Active sep-IPOP-CMA-ES */
54  sepaIPOP_CMAES = 10,
55  /* Active sep-BIPOP-CMA-ES */
56  sepaBIPOP_CMAES = 11,
57  /* VD-CMA-ES */
58  VD_CMAES = 12,
59  /* VD-IPOP-CMA-ES */
60  VD_IPOP_CMAES = 13,
61  /* VD-BIPOP-CMA-ES */
62  VD_BIPOP_CMAES = 14
63 };
64 
65 namespace libcmaes
66 {
70  template <class TESOStrategy,class TParameters,class TSolutions=CMASolutions>
71  class ESOptimizer : public TESOStrategy
72  {
73  public:
78  :TESOStrategy()
79  {
80  }
81 
87  ESOptimizer(FitFunc &func,
88  TParameters &parameters)
89  :TESOStrategy(func,parameters)
90  {
91  }
92 
99  ESOptimizer(FitFunc &func,
100  TParameters &parameters,
101  const TSolutions &solution)
102  :TESOStrategy(func,parameters,solution)
103  {
104  }
105 
106  ~ESOptimizer() {}
107 
112  int optimize()
113  {
114  std::chrono::time_point<std::chrono::system_clock> tstart = std::chrono::system_clock::now();
115  int opt = TESOStrategy::optimize();
116  std::chrono::time_point<std::chrono::system_clock> tstop = std::chrono::system_clock::now();
117  TESOStrategy::_solutions._elapsed_time = std::chrono::duration_cast<std::chrono::milliseconds>(tstop-tstart).count();
118  return opt;
119  }
120  };
121 
122 }
123 
124 #endif
ESOptimizer()
dummy constructor
Definition: esoptimizer.h:77
ESOptimizer(FitFunc &func, TParameters &parameters, const TSolutions &solution)
constructor for starting from an existing solution
Definition: esoptimizer.h:99
ESOptimizer(FitFunc &func, TParameters &parameters)
constructor
Definition: esoptimizer.h:87
linear scaling of the parameter space to achieve similar sensitivity across all components.
Definition: acovarianceupdate.cc:25
an optimizer main class.
Definition: esoptimizer.h:71
int optimize()
finds the minimum of a function, by calling on the underlying procedure of the EOSOptimizer object...
Definition: esoptimizer.h:112