Ultra 0.9.4
Loading...
Searching...
No Matches
evolution_selection.h
Go to the documentation of this file.
1
12
13#if !defined(ULTRA_EVOLUTION_SELECTION_H)
14#define ULTRA_EVOLUTION_SELECTION_H
15
16#include "kernel/evaluator.h"
18#include "kernel/parameters.h"
20
21#include <array>
22
23namespace ultra::selection
24{
25
29template<Evaluator E>
31{
32public:
34 evaluator_fitness_t<E>>;
35
36 strategy(E &, const parameters &);
37
38protected:
39 E &eva_;
40 const parameters &params_;
41};
42
64template<Evaluator E>
65class tournament : public strategy<E>
66{
67public:
68 using typename strategy<E>::scored_t;
69
70 using strategy<E>::strategy;
71
72 template<SizedRandomAccessPopulation P>
73 [[nodiscard]] std::vector<scored_t> operator()(const P &) const;
74};
75
76template<Evaluator E> tournament(E &, const parameters &) -> tournament<E>;
77
81template<Evaluator E>
82class alps : public strategy<E>
83{
84public:
85 using typename strategy<E>::scored_t;
86
87 using strategy<E>::strategy;
88
89 template<PopulationWithMutex P>
90 [[nodiscard]] std::array<scored_t, 2> operator()(
92};
93
94template<Evaluator E> alps(E &, const parameters &) -> alps<E>;
95
99class de
100{
101public:
102 template<Individual I>
104 {
105 I &target; // also called parent
106 const I &base;
107 const I &a;
108 const I &b;
109
110 // Due to reference aliasing all the data members could possibly point to
111 // the same individual.
112 // So the const-ness of `base`, `a` and `b` is only partial. Anyway it
113 // prevents some kinds of programming errors.
114 };
115
116 template<SizedRandomAccessPopulation P>
117 [[nodiscard]] selected_refs<typename P::value_type> operator()(P &) const;
118};
119
121
122} // namespace ultra::selection
123
124#endif // include guard
Definition alps.h:48
Definition evolution_selection.h:83
selected_refs< typename P::value_type > operator()(P &) const
Definition evolution_selection.h:214
strategy(E &, const parameters &)
Definition evolution_selection.h:29
Definition evolution_selection.h:66
Definition parameters.h:26
Definition scored_individual.h:48
Definition evolution_selection.h:104