<p>In <a href="https://github.com/mlpack/mlpack/pull/686#discussion_r69035530">src/mlpack/methods/ne/neat.hpp</a>:</p>
<pre style='color:#555'>> +
> + // Mutate: add new link to genome.
> + // TODO: what if created looped link? It will influence the depth calculation in genome class!!
> + // TODO: make innovation a class and pass as parameter? Also for other similar functions.
> + void MutateAddLink(Genome& genome, double mutateAddLinkProb) {
> + // Whether mutate or not.
> + double p = mlpack::math::Random();
> + if (p > mutateAddLinkProb) return;
> +
> + // Select from neuron
> + ssize_t fromNeuronIdx = mlpack::math::RandInt(0, genome.aNeuronGenes.size());
> + ssize_t fromNeuronId = genome.aNeuronGenes[fromNeuronIdx].Id();
> +
> + // Select to neuron which cannot be input.
> + ssize_t toNeuronIdx = mlpack::math::RandInt(genome.NumInput(), genome.aNeuronGenes.size());
> + ssize_t toNeuronId = genome.aNeuronGenes[toNeuronIdx].Id();
</pre>
<p>I think we have to make sure, that <code>fromNeuronIdx != toNeuronIdx</code>.</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/3c109959da112cebba341ac1e5f0143a4d5a85f2#r69035530">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe/AJ4bFEEJygJgXywhKtVVlsVkh4HXBIYpks5qQulYgaJpZM4IwJa6">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFHCnSV0C_sezmCr85ArMTJpK08T7ks5qQulYgaJpZM4IwJa6.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/3c109959da112cebba341ac1e5f0143a4d5a85f2#r69035530"></link>
<meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>