ECF
1.7
D:
Projekt
ECF
ECF_master
ECF
SelBestOp.cpp
1
#include "ECF_base.h"
2
#include "SelBestOp.h"
3
4
bool
SelBestOp::initialize
(StateP state)
5
{
6
state_ = state;
7
return
true
;
8
}
9
10
11
IndividualP
SelBestOp::select
(
const
std::vector<IndividualP>& pool)
12
{
13
if
(pool.empty())
14
return
IndividualP();
15
16
IndividualP best = pool[0];
17
for
(uint i = 1; i < pool.size(); i++) {
18
if
(!(best->fitness->isBetterThan(pool[i]->fitness))){
19
best = pool[i];
20
}
21
}
22
23
return
best;
24
}
25
SelBestOp::initialize
bool initialize(StateP)
Selection operator initialization. Must be called before individual selection.
Definition
SelBestOp.cpp:4
SelBestOp::select
IndividualP select(const std::vector< IndividualP > &)
Select one individual from a set.
Definition
SelBestOp.cpp:11
Generated on
for ECF by
1.18.0