[mlpack-git] [mlpack/mlpack] NeuralEvolution - implemented gene, genome (#686)

Marcus Edel notifications at github.com
Tue Jul 12 09:10:26 EDT 2016


> +  }
> +
> +  // Add genome to existing species or create new species.
> +  void AddGenomeToSpecies(Population& population, Genome& genome) {
> +    for (ssize_t i=0; i<population.aSpecies.size(); ++i) {
> +      if (population.aSpecies[i].aGenomes.size() > 0) {
> +        if (IsSameSpecies(population.aSpecies[i].aGenomes[0], genome)) {  // each first genome in species is the representative genome.
> +          population.aSpecies[i].AddGenome(genome);
> +          return;
> +        }
> +      }
> +    }
> +
> +    Species newSpecies = Species();
> +    newSpecies.AddGenome(genome);
> +    newSpecies.Id(population.NextSpeciesId());  // NOTICE: changed species id.

The species id is set in AddSpecies, so I guess we don't need to set it here.

---
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/ff45785b8669f82beb38ef5392f48bcdf5c83f6a#r70434031
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160712/a8c30513/attachment-0001.html>


More information about the mlpack-git mailing list