<p>In <a href="https://github.com/mlpack/mlpack/pull/686#discussion_r71068544">src/mlpack/methods/ne/neat.hpp</a>:</p>
<pre style='color:#555'>> + return;
> + }
> + }
> + }
> +
> + Species newSpecies = Species();
> + newSpecies.AddGenome(genome);
> + newSpecies.StaleAge(0);
> + population.AddSpecies(newSpecies);
> + }
> +
> + // Remove stale species.
> + void RemoveStaleSpecies(Population& population) {
> + for (ssize_t i=0; i<population.aSpecies.size(); ++i) {
> + if (population.aSpecies[i].StaleAge() > aStaleAgeThreshold) {
> + population.RemoveSpecies(i);
</pre>
<p>This function could cause an error, because we can't increase <code>i</code> if we remove a species:</p>
<pre><code> void RemoveStaleSpecies(Population& population)
{
for (std::vector<Species>::iterator it = population.aSpecies.begin();
it != population.aSpecies.end(); /*it++*/)
{
if(it->StaleAge() > aStaleAgeThreshold)
{
it = population.aSpecies.erase(it);
}
else
{
++it;
}
}
}
</code></pre>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/mlpack/mlpack/pull/686/files/fc982b9406838eb9697000481e816165702e8ba9#r71068544">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJ4bFFCKtir_kU5DsCgOcNFoozuVTyRdks5qWQjegaJpZM4IwJa6">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFGzbXMAHaMOwE708VJVGRiuSsxhKks5qWQjegaJpZM4IwJa6.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
<link itemprop="url" href="https://github.com/mlpack/mlpack/pull/686/files/fc982b9406838eb9697000481e816165702e8ba9#r71068544"></link>
<meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>