<p>In <a href="https://github.com/mlpack/mlpack/pull/686#discussion_r71089856">src/mlpack/methods/ne/neat.hpp</a>:</p>
<pre style='color:#555'>> + // Sort genomes by fitness. Smaller fitness is better and put first.
> + void SortGenomes(std::vector<Genome>& genomes) {
> + std::sort(genomes.begin(), genomes.end(), Species::CompareGenome);
> + }
> +
> + // Get genome index in a genomes vector.
> + ssize_t GetGenomeIndex(std::vector<Genome>& genomes, ssize_t id) {
> + for (ssize_t i=0; i<genomes.size(); ++i) {
> + if (genomes[i].Id() == id)
> + return i;
> + }
> + return -1;
> + }
> +
> + // Calculate species' average rank in population by fitness. Bigger is better.
> + void CalcSpeciesAverageRank(Population& population, std::vector<double>& speciesAverageRank) {
</pre>
<p>I thought it would be easier to rank the genomes, directly by the fitness value instead of checking at which position the genome is after sorting.</p>
<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#r71089856">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJ4bFKNsVlssJX5ClajP6g_od8SRMkiLks5qWp3XgaJpZM4IwJa6">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFJFvb6vi03DUZTUd-luD-qcz90DPks5qWp3XgaJpZM4IwJa6.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#r71089856"></link>
<meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>