GENEIAL  0.2=/
 All Classes Pages
Fitness.h
1 #pragma once
2 
3 #include <geneial/utility/mixins/Printable.h>
4 
5 #include <boost/optional.hpp>
6 
7 #include <memory>
8 
9 namespace __geneial_noexport
10 {
11 using ::geneial::utility::Printable;
12 
13 inline namespace exports
14 {
15 using namespace geneial;
16 
24 template<typename FITNESS_TYPE>
25 class Fitness: public Printable
26 {
27 private:
28  boost::optional<FITNESS_TYPE> _value;
29 
30 public:
31  Fitness()
32  {
33  }
34 
35  explicit Fitness(FITNESS_TYPE value) :
36  _value(value)
37  {
38  }
39 
40  virtual ~Fitness()
41  {
42  }
43 
44  inline void set(FITNESS_TYPE value);
45 
46  inline FITNESS_TYPE get() const;
47 
48  //cast operator overload
49  inline operator FITNESS_TYPE() const
50  {
51  return get();
52  }
53 
54  //cast operator overload
55  inline FITNESS_TYPE operator()() const
56  {
57  return get();
58  }
59 
60  virtual bool isValid() const;
61 
62  void print(std::ostream&) const;
63 };
64 
65 
66 } /* namespace exports */
67 } /* namespace __geneial_noexport */
68 
69 namespace geneial
70 {
71  using namespace ::__geneial_noexport::exports;
72 }
73 
74 #include <geneial/core/fitness/Fitness.hpp>
75 
This class encapsulates the fitness.
Definition: Fitness.h:25