Vita
evolution_selection.h
Go to the documentation of this file.
1
13#if !defined(VITA_EVOLUTION_SELECTION_H)
14#define VITA_EVOLUTION_SELECTION_H
15
16#include <set>
17
18#include "kernel/alps.h"
19#include "kernel/population.h"
20
21namespace vita::selection
22{
23
34template<class T>
36{
37public:
38 using parents_t = std::vector<typename population<T>::coord>;
39
40 strategy(const population<T> &, evaluator<T> &, const summary<T> &);
41
42protected:
43 const population<T> &pop_;
44 evaluator<T> &eva_;
45 const summary<T> &sum_;
46};
47
69template<class T>
70class tournament : public strategy<T>
71{
72public:
73 using tournament::strategy::strategy;
74
75 typename strategy<T>::parents_t run();
76};
77
82template<class T>
83class alps : public strategy<T>
84{
85public:
86 using alps::strategy::strategy;
87
88 typename strategy<T>::parents_t run();
89
90private:
91 [[nodiscard]] bool aged(const typename population<T>::coord &) const;
92 [[nodiscard]] typename population<T>::coord pickup(unsigned,
93 double = 1.0) const;
94};
95
100template<class T>
101class pareto : public strategy<T>
102{
103public:
104 using pareto::strategy::strategy;
105
106 typename strategy<T>::parents_t run();
107
108private:
109 void front(const std::vector<unsigned> &, std::set<unsigned> *,
110 std::set<unsigned> *) const;
111};
112
120template<class T>
121class random : public strategy<T>
122{
123public:
124 using random::strategy::strategy;
125
126 typename strategy<T>::parents_t run();
127};
128
129#include "kernel/evolution_selection.tcc"
130
131} // namespace vita::selection
132
133#endif // include guard
Calculates the fitness of an individual.
Definition: evaluator.h:54
A group of individuals which may interact together (for example by mating) producing offspring.
Definition: population.h:37
Pareto tournament selection as described in "Pursuing the Pareto Paradigm" (Mark Kotanchek,...
Pick a set of random individuals.
The strategy (tournament, fitness proportional...) for the evolution class.
Tournament selection is a method of selecting an individual from a population of individuals.
A summary of evolution (results, statistics...).
Contains support functions for the ALPS algorithm.