GENEIAL  0.2=/
 All Classes Pages
UniformRandomSelection.h
1 #pragma once
2 
3 #include <geneial/core/operations/selection/BaseSelectionOperation.h>
4 #include <geneial/utility/mixins/EnableMakeShared.h>
5 
6 #include <map>
7 #include <stdexcept>
8 
9 geneial_private_namespace(geneial)
10 {
11 geneial_private_namespace(operation)
12 {
13 geneial_private_namespace(selection)
14 {
15 using ::geneial::utility::EnableMakeShared;
16 
17 geneial_export_namespace
18 {
19 
23 template<typename FITNESS_TYPE>
24 class UniformRandomSelection: public BaseSelectionOperation<FITNESS_TYPE>,
25  public virtual EnableMakeShared<UniformRandomSelection<FITNESS_TYPE>>
26 {
27 protected:
28  UniformRandomSelection(const std::shared_ptr<BaseSelectionSettings> &settings) :
29  BaseSelectionOperation<FITNESS_TYPE>(settings)
30  {
31  }
32 
33  virtual ~UniformRandomSelection()
34  {
35  }
36 public:
37  virtual typename BaseSelectionOperation<FITNESS_TYPE>::selection_result_set doSelect(
38  const Population<FITNESS_TYPE> &population, BaseManager<FITNESS_TYPE> &manager) const override;
39 
40  class Builder : public BaseSelectionOperation<FITNESS_TYPE>::Builder
41  {
42 
43  public:
44  Builder() : BaseSelectionOperation<FITNESS_TYPE>::Builder()
45  {
46  }
47 
48  typename BaseSelectionOperation<FITNESS_TYPE>::ptr create() override
49  {
50  return UniformRandomSelection<FITNESS_TYPE>::makeShared(this->_settings);
51  }
52 
53  };
54 
55 };
56 
57 } /* geneial_export_namespace */
58 } /* private namespace selection */
59 } /* private namespace operation */
60 } /* private namespace geneial */
61 
62 #include <geneial/core/operations/selection/UniformRandomSelection.hpp>
63