15 using Class = br::Var::Variation<PT>;
18 py::class_<Class> vary(m, name.data() );
23 .def(
"mutate", &Class::mutate, py::return_value_policy::automatic)
24 .def(
"cross", &Class::cross, py::return_value_policy::automatic)
26 std::vector<br::Pop::Individual<PT>>& individuals,
28 if (individuals.size() != params.
pop_size) {
29 string msg =
"Individual vector has different number of "
30 "individuals than pop_size. When calling "
31 "variation, they should be the same. popsize is "+
33 "individuals is "+
to_string(individuals.size());
35 throw std::runtime_error(
msg);
38 auto pop = br::Pop::Population<PT>();
40 pop.init(individuals, params);
42 vector<br::Pop::Individual<PT>>
pool;
53 pop.add_offspring_indexes(
island);