dignea  1.0.0
Diverse Instance Generator with Novelty Search and Evolutionary Algorithms
SelFactory.h
Go to the documentation of this file.
1 
11 #ifndef DIGNEA_SELFACTORY_H
12 #define DIGNEA_SELFACTORY_H
13 
14 #include <dignea/core/Selection.h>
15 #include <dignea/core/Solution.h>
18 
24 template <class S>
25 class SelFactory {
26  private:
27  map<SelType, function<unique_ptr<Selection<S>>()>> factories;
28 
29  public:
30  SelFactory() {
31  factories[SelType::Binary] = [] {
32  return make_unique<BinaryTournamentSelection<S>>();
33  };
34  }
35 
41  unique_ptr<Selection<S>> create(SelType type) { return factories[type](); }
42 };
43 
44 #endif // DIGNEA_SELFACTORY_H
SelType
Types of Selection Operators implemented in dignea.
Definition: SelectionTypes.h:19
Selection factory which allows the user to create Selection Operators easily.
Definition: SelFactory.h:25
unique_ptr< Selection< S > > create(SelType type)
Creates a unique pointer to a Selection Operator of type.
Definition: SelFactory.h:41