Helios++
Helios software for LiDAR simulations
Minimizer.h
1 #pragma once
2 
3 #include <boost/serialization/serialization.hpp>
4 
5 #include <functional>
6 
7 namespace fluxionum{
8 
9 using std::function;
10 
30 template <typename IT, typename OT>
31 class Minimizer {
32 private:
33  // *** SERIALIZATION *** //
34  // *********************** //
35  friend class boost::serialization::access;
42  template <typename Archive>
43  void serialize(Archive &ar, unsigned int const version){
44  ar &f;
45  }
46 
47 protected:
48  // *** ATTRIBUTES *** //
49  // ******************** //
53  function<OT(IT)> f;
54 
55 public:
56  // *** CONSTRUCTION / DESTRUCTION *** //
57  // ************************************ //
63  Minimizer(function<OT(IT)> f) : f(f) {}
64  virtual ~Minimizer() = default;
65 
66  // *** MINIMIZATION *** //
67  // ********************** //
74  virtual IT argmin(IT x) = 0;
75 
76  // *** GETTERs and SETTERs *** //
77  // ***************************** //
83  virtual function<OT(IT)> getF() const {return f;}
89  virtual void setF(function<OT(IT)> f) {this->f = f;}
90 };
91 
92 }
Base abstract class providing basic structure for minimization optimization of a given function.
Definition: Minimizer.h:31
void serialize(Archive &ar, unsigned int const version)
Serialize the minimizer to a stream of bytes.
Definition: Minimizer.h:43
function< OT(IT)> f
The function to be minimized.
Definition: Minimizer.h:53
virtual function< OT(IT)> getF() const
Obtain the function to be minimized.
Definition: Minimizer.h:83
virtual void setF(function< OT(IT)> f)
Set the function to be minimized.
Definition: Minimizer.h:89
virtual IT argmin(IT x)=0
Find the argument which minimizes minimizer's function.
Minimizer(function< OT(IT)> f)
Minimizer default constructor.
Definition: Minimizer.h:63