[mlpack-git] [mlpack/mlpack] Neural evolution algorithms implementation (CNE, NEAT, HyperNEAT) (#686)

Marcus Edel notifications at github.com
Sat Jul 16 12:37:50 EDT 2016


> +          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);

This function could cause an error, because we can't increase `i` if we remove a species:

```
  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;
      }
    }
  }
```

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/pull/686/files/fc982b9406838eb9697000481e816165702e8ba9#r71068544
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160716/49afea17/attachment.html>


More information about the mlpack-git mailing list