<p>In <a href="https://github.com/mlpack/mlpack/pull/686#discussion_r66710297">src/mlpack/methods/ne/population.hpp</a>:</p>
<pre style='color:#555'>&gt; +  // Destructor.
&gt; +  ~Population() {}
&gt; +
&gt; +  // Set/get best fitness.
&gt; +  double&amp; BestFitness() { return aBestFitness; }
&gt; +
&gt; +  // Set best fitness to be the minimum of all genomes&#39; fitness.
&gt; +  void SetBestFitness() {
&gt; +    if (aGenomes.size() == 0) 
&gt; +      return;
&gt; +
&gt; +    aBestFitness = aGenomes[0].Fitness();
&gt; +    for (size_t i=0; i&lt;aGenomes.size(); ++i) {
&gt; +      if (aGenomes[i].Fitness() &lt; bestFitness) {
&gt; +        aBestFitness = aGenomes[i].Fitness();
&gt; +      }
</pre>
<p>Yeah, I have this idea in my mind. Actually I think we can add a SortByFitness() function to sort the genomes in population, so that we can get k best genomes easily.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<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/65f093daf32f6cb353cd6b9304bab88a5e096fdc#r66710297">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe/AJ4bFFFLotv9Ua49DT8STsKh9pnuMk_Dks5qKwfvgaJpZM4IwJa6">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFITo73i9jwK7Gy6qXG_1JB-INbuSks5qKwfvgaJpZM4IwJa6.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/65f093daf32f6cb353cd6b9304bab88a5e096fdc#r66710297"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>