Brush C++ API
A flexible interpretable machine learning framework
Toggle main menu visibility
Loading...
Searching...
No Matches
selection_operator.h
Go to the documentation of this file.
1
#ifndef SELECTION_OPERATOR_H
2
#define SELECTION_OPERATOR_H
3
4
// virtual class. selection must be made with static methods
5
6
// #include "../init.h"
7
// #include "../data/data.h"
8
// #include "../types.h"
9
// #include "../params.h"
10
#include "
../pop/population.h
"
11
12
namespace
Brush
{
13
namespace
Sel
{
14
15
using namespace
Brush;
16
using namespace
Pop
;
17
18
// TODO: stop having to give the template for the selection operator (and also other places like pop)
19
24
template
<ProgramType T>
30
class
SelectionOperator
31
{
32
public
:
33
bool
survival
;
34
string
name
;
35
39
virtual
~SelectionOperator
();
40
49
virtual
vector<size_t>
select
(
Population<T>
& pop,
int
island,
const
Parameters
& p);
50
59
virtual
vector<size_t>
survive
(
Population<T>
& pop,
int
island,
const
Parameters
& p);
60
};
61
62
extern
template
class
SelectionOperator<PT::Regressor>
;
63
extern
template
class
SelectionOperator<PT::BinaryClassifier>
;
64
extern
template
class
SelectionOperator<PT::MulticlassClassifier>
;
65
extern
template
class
SelectionOperator<PT::Representer>
;
66
67
}
// selection
68
}
// Brush
69
#endif
Brush::Pop::Population
Definition
population.h:12
Brush::Sel::SelectionOperator
The SelectionOperator class represents a base class for selection operators in a genetic algorithm.
Definition
selection_operator.h:31
Brush::Sel::SelectionOperator::select
virtual vector< size_t > select(Population< T > &pop, int island, const Parameters &p)
Selects individuals from the population based on the selection operator's strategy.
Definition
selection_operator.cpp:13
Brush::Sel::SelectionOperator::survival
bool survival
Definition
selection_operator.h:33
Brush::Sel::SelectionOperator::name
string name
Definition
selection_operator.h:34
Brush::Sel::SelectionOperator::~SelectionOperator
virtual ~SelectionOperator()
Destructor for the SelectionOperator class.
Definition
selection_operator.cpp:10
Brush::Sel::SelectionOperator::survive
virtual vector< size_t > survive(Population< T > &pop, int island, const Parameters &p)
Applies the selection operator to determine which individuals survive in the population.
Definition
selection_operator.cpp:21
Brush::Pop
Definition
individual.cpp:4
Brush::Sel
Definition
lexicase.cpp:4
Brush
< nsga2 selection operator for getting the front
Definition
bandit.cpp:3
population.h
Brush::Parameters
Definition
params.h:20
src
selection
selection_operator.h
Generated by
1.17.0