Helios++
Helios software for LiDAR simulations
UnivariateNewtonRaphsonMinimizer.h
1 #ifndef _UNIVARIATENEWTONRAHPSONMINIMIZER_H_
2 #define _UNIVARIATENEWTONRAHPSONMINIMIZER_H_
3 
4 #include <DiffMinimizer.h>
5 #include <IterativeMethodHandler.h>
6 
7 #include <boost/serialization/serialization.hpp>
8 
9 namespace fluxionum{
10 
22 template <typename IT, typename OT>
24 private:
25  // *** SERIALIZATION *** //
26  // *********************** //
27  friend class boost::serialization::access;
36  template <typename Archive>
37  void serialize(Archive &ar, unsigned int const version){
38  boost::serialization::void_cast_register<
41  >();
42  ar &boost::serialization::base_object<
44  >(*this);
45  ar &imh;
46  }
47 
48 protected:
49  // *** ATTRIBUTES *** //
50  // ******************** //
57 
58 public:
59  // *** CONSTRUCTION / DESTRUCTION *** //
60  // ************************************ //
68  function<OT(IT)> f,
69  vector<function<OT(IT)>> df
70  ) :
71  DiffMinimizer<IT, OT>(f, df),
73  1000,
74  false,
75  0.000000001,
76  3,
77  0.000000001,
78  true
79  ))
80  {}
89  function<OT(IT)> f,
90  function<OT(IT)> df,
91  function<OT(IT)> d2f
92  ) :
93  DiffMinimizer<IT, OT>(f, vector<function<OT(IT)>>({df, d2f})),
95  1000,
96  false,
97  0.000000001,
98  3,
99  0.000000001,
100  true
101  ))
102  {}
103  virtual ~UnivariateNewtonRaphsonMinimizer() = default;
104 
105  // *** MINIMIZATION *** //
106  // ********************** //
118  IT argmin(IT x) override;
119 
120  // *** GETTERs and SETTERs *** //
121  // ***************************** //
135  )
136  {this->imh = imh;}
137 };
138 
139 
140 }
141 #endif
142 
143 #include <UnivariateNewtonRaphsonMinimizer.tpp>
Base abstract class providing basic structure for minimization optimization of a given function based...
Definition: DiffMinimizer.h:28
vector< function< OT(IT)> > df
The derivatives of the function to be minimized such that df[i] corresponds with .
Definition: DiffMinimizer.h:53
function< OT(IT)> f
The function to be minimized.
Definition: Minimizer.h:53
Implementation of univariate Newton-Raphson minimizer.
Definition: UnivariateNewtonRaphsonMinimizer.h:23
IterativeMethodHandler< IT, OT > imh
Iterative method handler for the univariate Newton-Raphson minimization.
Definition: UnivariateNewtonRaphsonMinimizer.h:56
UnivariateNewtonRaphsonMinimizer(function< OT(IT)> f, function< OT(IT)> df, function< OT(IT)> d2f)
Alternative constructor for univariate Newton-Raphson minimizer.
Definition: UnivariateNewtonRaphsonMinimizer.h:88
IterativeMethodHandler< IT, OT > & getIterativeMethodHandler()
Obtain the iterative method handler.
Definition: UnivariateNewtonRaphsonMinimizer.h:127
IT argmin(IT x) override
Implementation of the univariate Newton-Raphson minimization.
void setIterativeMethodHandler(IterativeMethodHandler< IT, OT > const &imh)
Set the iterative method handler.
Definition: UnivariateNewtonRaphsonMinimizer.h:133
UnivariateNewtonRaphsonMinimizer(function< OT(IT)> f, vector< function< OT(IT)>> df)
Default constructor for univariate Newton-Raphson minimizer.
Definition: UnivariateNewtonRaphsonMinimizer.h:67
void serialize(Archive &ar, unsigned int const version)
Serialize the univariate Newton-Raphson minimizer to a stream of bytes.
Definition: UnivariateNewtonRaphsonMinimizer.h:37