32 unsigned int N = pop.
individuals.at(island_pool.at(0))->error.size();
35 unsigned int P = island_pool.size();
38 ArrayXf epsilon = ArrayXf::Zero(N);
42 || params.
scorer_.compare(
"multi_log")==0)
45 for (
int i = 0; i<epsilon.size(); ++i)
47 VectorXf case_errors(island_pool.size());
48 for (
int j = 0; j<island_pool.size(); ++j)
50 case_errors(j) = pop.
individuals.at(island_pool[j])->error(i);
52 epsilon(i) =
mad(case_errors);
55 assert(epsilon.size() == N);
58 vector<size_t> starting_pool;
59 for (
int i = 0; i < island_pool.size(); ++i)
61 starting_pool.push_back(island_pool[i]);
63 assert(starting_pool.size() == P);
65 vector<size_t> selected(P,0);
67 for (
unsigned int i = 0; i<P; ++i)
74 vector<size_t> choices(N);
75 std::iota(choices.begin(), choices.end(),0);
79 for (
unsigned i = 0; i<N; ++i)
81 vector<size_t> choice_indices(N-i);
82 std::iota(choice_indices.begin(),choice_indices.end(),0);
84 size_t idx = *
r.select_randomly(
85 choice_indices.begin(), choice_indices.end(),
86 sample_weights.begin(), sample_weights.end());
88 cases.push_back(choices.at(idx));
89 choices.erase(choices.begin() + idx);
91 sample_weights.erase(sample_weights.begin() + idx);
97 std::iota(cases.begin(),cases.end(),0);
98 r.shuffle(cases.begin(),cases.end());
100 vector<size_t> pool = starting_pool;
101 vector<size_t> winner;
106 float epsilon_threshold;
109 epsilon_threshold = 0;
113 float minfit = std::numeric_limits<float>::max();
116 for (
size_t j = 0; j<pool.size(); ++j)
117 if (pop.
individuals.at(pool[j])->error(cases[h]) < minfit)
118 minfit = pop.
individuals.at(pool[j])->error(cases[h]);
121 epsilon_threshold = minfit+epsilon[cases[h]];
124 for (
size_t j = 0; j<pool.size(); ++j)
126 <= epsilon_threshold)
127 winner.push_back(pool[j]);
131 pass = (winner.size()>1 && h<cases.size());
133 if(winner.size() == 0)
135 if(h >= cases.size())
136 winner.push_back(*
r.select_randomly(
137 pool.begin(), pool.end()) );
145 assert(winner.size()>0);
148 selected.at(i) = *
r.select_randomly(
149 winner.begin(), winner.end() );
154 if (selected.size() != island_pool.size())