26 py::class_<Class> sel(m, name.data() );
30 [](
string type,
bool survival){ Class s(type, survival);
return s; })
32 .def(
"select", [](Class &self,
39 pop.init(individuals, params);
41 vector<br::Pop::Individual<PT>> pool;
44 for (
int island = 0; island < params.
num_islands; ++island)
46 vector<size_t> selected = self.select(pop, island, params);
50 for (
size_t idx : selected) {
51 pool.push_back(pop[idx]);
57 .def(
"survive", [](Class &self,
64 pop.init(individuals, params);
66 vector<br::Pop::Individual<PT>> pool;
69 for (
int island = 0; island < params.
num_islands; ++island)
71 vector<size_t> selected = self.survive(pop, island, params);
73 for (
size_t idx : selected) {
74 pool.push_back(pop[idx]);
80 .def(
"migrate", [](Class &self,
86 pop.init(individuals, params);
89 vector<br::Pop::Individual<PT>> pool;
92 for (
int island = 0; island < params.
num_islands; ++island)
94 vector<size_t> selected = pop.get_island_indexes(island);
96 for (
size_t idx : selected) {
97 pool.push_back(pop[idx]);